Problem with synchronize files with GUI

1 次查看(过去 30 天)
Hi all,
I have a problem with Matlab.
I'm importing real-time data from two electrical components are stored in two different txt files.
To represent the parameters of these two files in the same graph, "Matlab" returns the following message:
Warning: While loading an object of class 'timer':
Cell contents reference cell from a non-array object.
> In exportandoArchivo> process at 202
  In exportandoArchivo> pushStart_Callback at 126
  In gui_mainfcn at 96
  In exportandoArchivo at 42
  In @ (hObject, eventdata) exportandoArchivo ('pushStart_Callback' hObject, eventdata, guidata (hObject))
I check txt files, and it seems the data import process stops. I also realize parameter operations both txt file, for example:
result (i, 1) = textFile1 (i, 1) + textfile (i, 1);
Therefore, I think that apparently are not fully synchronized and in an instant, a txt file has a different dimension of the other, and this is the error message.
All this, I do it by Matlab GUI
How I can solve?
Thank you very much
  1 个评论
Walter Roberson
Walter Roberson 2015-5-20
The warning has nothing to do with a mismatch in file sizes (probably).
We would need to look at the code near line 202 of exportandoArchivo

请先登录,再进行评论。

采纳的回答

Walter Roberson
Walter Roberson 2015-5-20
编辑:Walter Roberson 2015-5-20
save 'data.mat'
asks that all variables in the current workspace be saved into the given .mat file. Not just the variable 'data', also the variable data1 and fullname and fullname1 get saved too. As does hObject, eventdata, and handles. As handles is a structure that refers to graphics objects and other random objects, probably some timers too, all of those get saved in data.mat
And then on the next line, you save all of those all over again, but to 'data1.mat'.
Then further down, you
load('data.mat')
That reads all of those variables out of the data.mat file, overwriting whatever values they had in memory. This requires restoring the state of all of the objects included in the .mat file, including all of the items stored under the handles structure. The load has difficulty restoring the timers and warns you about that.
You should immediately stop using save commands that do not list the exact variables to be saved. You should also immediately stop using load() except when you assign the output of load to a variable.
save('data.mat', 'data');
...
loadedvars = load('data.mat', 'data'); %returns a struct of the variables
data = loadedvars.data; %the part of the struct that is of interest
In terms of that particular routine, the variables data and data1 have not gone anywhere, and there is no need to load() them from the .mat file. They are still there from where they were read in via dlmread(). I would not even bother to save() them unless you have a particular reason to do so.
You should probably read through this as well:

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Environment and Settings 的更多信息

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by