Hi everyone,
I want to plot (in a GUI) datas from a cell array. This cell array is contained in a structure, and this structure is stored in the handles.
I have something like:
handles (1×1) > Struct (1xhandles.n) > Data (XXXX*XX cells)
I have a lot of data and I want to plot some columns. I tried this :
for i=1:handles.nhandles.plot(i)=plot(handles.struct(i).data{:,handles.colum+3},handles.struct(i).data{:,handles.colum+1});end
And this
for i=1:handles.nhandles.plot(i)=plot([handles.struct(i).data{:,handles.colum+3}],[handles.struct(i).data{:,handles.colum+1}]);end
Both are not working. I get this error msg :
Error using plotInvalid first data argument
I guess plot can't access values inside the datas cell array.
I succeeded doing this plot by creating a matrice, which store data and then it is quite easy to plot.
for i=1:handles.n for j=1:lentgh() X(j,i)=handles.struct(i).data{j,handles.column+3}; Y(j,i)=handles.struct(i).data{j,handles.column+1} end handles.plot(i)=plot(X(:,i),Y(:,i));end
This one works but I'm sure there is a better way of doing this, and a faster too.
Feel free to answer ! Thx.
Best Answer