MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn moreOpportunities for recent engineering grads.

Apply TodayTo resolve issues starting MATLAB on Mac OS X 10.10 (Yosemite) visit: http://www.mathworks.com/matlabcentral/answers/159016

Asked by Kesni savitri on 14 May 2013

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.

*No products are associated with this question.*

Answer by Walter Roberson on 14 May 2013

Accepted answer

table_handle = uitable('Position', ..... );

table_as_cell = num2cell(YourMatrix);

set(table_handle, 'Data', table_as_cell);

Kesni savitri on 14 May 2013

thanks for your answered,.

"set(table_handle, 'Data', table_as_cell);"

that you mean 'Data' is load from other file? the result nitrogens consentration that i want in table gui, not from other file, but get from the calculate differential equation that solve with ODE45 in this script.

Walter Roberson on 14 May 2013

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.

## 2 Comments

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/75744#comment_148931

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:

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

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/75744#comment_148940

thanks for your answered,. the result nitrogens consentration that i want in table gui, not from other file, but get from the calculate differential equation that solve with ODE45. there is 8 differential equation. y(1), y(2),..... y(8)..

_in pushbutton callback ,,

opts=odeset('Refine',10); [t,y]=ode45(@nitrogen,[0 2160],... [0.01 0.1 0.8 0 0 0 3.47 5.2]);

axes(handles.N_graphic)

% i get show the plot

Plot(handles,t,y,'konsentrasi nitrogen','waktu simulasi (jam)','konsentrasi (mg N / L)');

but, how can i get the result in table?