Info

This question is closed. Reopen it to edit or answer.

UiTable print and data stracture change questions

1 view (last 30 days)
stamatis
stamatis on 9 Apr 2013
Closed: MATLAB Answer Bot on 20 Aug 2021
Hello
I am new to the gui construction and how to do things so now i am stuck with a uitable. I created a table through the guide quick start but i face some problems with the data edit. I wanna do algebric calculations with the data.
I store the uitable data to a variable like this :
a=get(handles.table1,'data');
But when i try to run the rest of the .m file
for i = 1 : size(a,1)-1
SectionArea(i,1)=(a(i,3)+a(i+1,3))*(a(i+1,2)-a(i,2))/2;
P(i,1)=sqrt((a(i,3)-a(i+1,3))^2+(a(i+1,2)-a(i,2))^2);
end
i get this error
Undefined function or method 'plus' for input arguments of type 'cell'.
Error in ==> DischargeFlow_1>calculate_Callback at 184 SectionArea(i,1)=(a(i,3)+a(i+1,3))*(a(i+1,2)-a(i,2))/2;
Error in ==> gui_mainfcn at 96 feval(varargin{:});
Error in ==> DischargeFlow_1 at 42 gui_mainfcn(gui_State, varargin{:});
Error in ==> @(hObject,eventdata)DischargeFlow_1('calculate_Callback',hObject,eventdata,guidata(hObject))
??? Error while evaluating uicontrol Callback
I tried already to use the function b=cell2mat(a) but i get this error
Error using ==> cat CAT arguments dimensions are not consistent.
Error in ==> cell2mat at 84 m = cat(1,m{:});
Error in ==> DischargeFlow_1>calculate_Callback at 176 b=cell2mat(a);
Error in ==> gui_mainfcn at 96 feval(varargin{:});
Error in ==> DischargeFlow_1 at 42 gui_mainfcn(gui_State, varargin{:});
Error in ==> @(hObject,eventdata)DischargeFlow_1('calculate_Callback',hObject,eventdata,guidata(hObject))
??? Error while evaluating uicontrol Callback
I dont know what to do and i am stuck any help would be geatfull.
Also i would like to ask how to store the data of a uitable to a .txt file

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!