How can I get display the result in a table GUI matlab
19 次查看(过去 30 天)
显示 更早的评论
I am student in chemical Engineering, I am using MATLAB to solve eight differential equations describing nitrogen transformation. and I used GUI, i have a trouble to display nitrogen dynamic result in a table GUI. i want after i click the pushbutton, i get the result in a table.
So How can I get MATLAB to created a table that shows the concentrations of each transformation nitrogen??
I'm new in GUI matlab and would appreciate some help to do this.
2 个评论
Jules Ray
2013-5-14
as i understand you table could a .txt? and u are using GIDE to create the GUI
below the callback of your button you must write the code:
example:
%define the variables that you want in the table
a=handles.a
%if the variables comes from other place into the guy use handles to define and to call the value
b=handles.b
c=handles.c
%now format the table that contains 3 columns
file=('yourtable.txt');
fid = fopen(file, 'a');
fprintf(fid,'%u %u %6.0f ',a,b,c);
%if you want to use a header in your table put this line below fid
fprintf(fid,'value_a value_b value_c');
is very important to correctly define the values a, b,c below their respective callbacks, always used handles.yourvalue to move this values into the different callbacks of the GUI
采纳的回答
Walter Roberson
2013-5-14
table_handle = uitable('Position', ..... );
table_as_cell = num2cell(YourMatrix);
set(table_handle, 'Data', table_as_cell);
3 个评论
Walter Roberson
2013-5-14
YourMatrix = [t, y];
table_as_cell = num2cell(YourMatrix);
table_handle = uitable('Position', ..... );
set(table_handle, 'Data', table_as_cell);
Data is not loaded from another file: it is loaded from the variable "table_as_cell" which is constructed in the lines above from your existing data.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Interactive Control and Callbacks 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!