GUI store the output data in matrix
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Hi,
Now I have 2 output data and 1 button. When I press the button in the firsr time, 2 output data will store in first row. And when I press second times, It will store in second row, and so on.
function Plotting_button_Callback(hObject, eventdata, handles)
%output data
d1=str2num(get(handles.d1,'string'));
assignin('base','d1',d1);
ns=str2num(get(handles.ns,'string'));
assignin('base','ns',ns);
% store data
Store_data = [];
i=1;
Data_Number = str2num(get(handles.Data_Number,'string')); % data number test box
Data_Number = Data_Number + 1; % add 1 if pressing the button
set(handles.Data_Number,'string' , Data_Number)
assignin('base','Data_Number_updated',Data_Number);
Store_data(Data_Number,1) = d1;
Store_data(Data_Number,2) = ns;
assignin('base','Store_data',Store_data); % store data
And now, it's able to become a matrix. but the matrix just has correct value when last press, other time the output values repalce number to 0.
For example, I press this button 9 times and I didn't change anything, so the number should be all 1. However it becomes
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
1 1
--------------
0 comentarios
Respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!