Storing a multiple data into table GUI using a pushbutton and a checkbutton
3 次查看(过去 30 天)
显示 更早的评论
Hello,
I am developing a GUI in MATLAB using GUIDE and I have some pre calculated numeric values A, B and C (there are more) which I converted to cells using num2cell in order to store them in a table.
Now I want to store these calculated values in a table (in columns AA, BB and CC) in a table named Table_results by clicking on a Pushbutton with previously checked/unchecked checkbutton (this is to check wheather to use or not to use these pre calculated data).
I am struggling with how to put them all in a table, since only the last dataset C is stored in a table Table_results:
I tried something like this which, if I use them one at a time, gives me the value (AA, BB or CC) stored in a Table_results.
But when I use this code below, the last value CC is overriding the previous two:
set(handles.Results_table, 'Data', A);
set(handles.Results_table, 'Data', B);
set(handles.Results_table, 'Data', C);
set(handles.Results_table,'ColumnName',{'AA'}) %%this is in order to name my columns AA, BB and CC
set(handles.Results_table,'ColumnName',{'BB'})
set(handles.Results_table,'ColumnName',{'CC'})
I have more data to implement in this same manner, so in the end I am looking to write a code that enables me to store only the data i selected in checkbutton and display them in a Table results table when I click on a Pushbutton.
Any help would be greatly appreciated.
Thanks in advance!
回答(1 个)
Akhilesh Thakur
2017-8-3
When you are using set(handles.Results_table,'ColumnName',{'CC'}) its storing any data in the same address that is handles.Results_table. You can use setappdata and getappdata. By this you can share data to different GUI's and it is pretty powerful. If you want to make your data global use setappdata(0,..... ) . Always store with different names. If you are using same name and same address it's going to overwrite your previous data. That's how set and get works. Hope this helps.
2 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Annotations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!