我创建了一个 matfile,其中存储了不断被用户行为覆盖的数据。这发生在函数“test()”中。
n=1
while n < 5
myVal = double(Test704(1, 780, -1)) %Returns the user's behavior
if myVal == 1
n = n + 1 %"n" is the overwritten variable in the matfile
end
save('testSave1.mat') %The matfile
m = matfile('testSave1.mat')
end
然后,我想在另一个名为“storageTest()”的函数(必须有两个独立的函数)中显示这些数据。更具体地说, storageTest() 是一个 GUI 函数,我在其中开发了一个合适的“t”。因此,我首先调用函数“test()”并将其输出值作为“t”的数据。下面是“storageTest”有趣部分的代码:
m = test()
d = [m.n]
t = uitable('Data',d, ...
'ColumnWidth',{50}, ...
'Position',[100 100 461 146]);
t.Position(3) = t.Extent(3);
t.Position(4) = t.Extent(4);
drawnow
此代码仅在“m = test()”运行结束时执行,并向我显示一个选项卡,在该选项卡中我可以看到“n”的最终值。但是,我希望我的表格之前显示并看到我的值根据用户的行为而增加。我已经在网上搜索以解决我的问题,但我找不到任何答案,是否有可能做这样的事情?