I'm just trying to get some user inputs from an uitable (made with GUIDE), and save this inputs as doubles to calculate another value and put on the uitable So here is the code...
% --- Executes on button press in CTE.
function CTE_Callback(hObject, eventdata, handles)
% hObject handle to CTE (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
DATA = get(handles.uitable2,'data');
for I = 1:5
s = DATA(1,I);
d = DATA(2,I);
u = DATA(3,I);
p = DATA(4,I);
t = DATA(5,I);
r = DATA(6,I);
c = DATA(7,I);
a = DATA(8,I);
if ((2 * s * d * u) > 0) && (((t + r) * c) + (2 * a * (1 - (u / p))) ~= 0)
X = ((2 * s * d * u) ^ (1 / 2)) / ((((t + r) * c) + 2 * a * (1 - (u / p))) ^ (1 / 2));
else
disp('error,ingrese unicamente numeros positivos');
end
DATA(9,I) = X;
end
set(handles.uitable2, 'data', DATA);
but I'm getting this error...
Undefined function 'mtimes' for input arguments of type 'cell'.
Error in GuiFinal>CTE_Callback (line 133)
if ((2 * s * d * u) > 0) && (((t + r) * c) + (2 * a * (1 - (u / p))) ~= 0)
Any idea of what is happening, I just don't see what's wrong
It looks like
DATA
is a cell array. You probably need to index it with curly braces:and then later on:
and at the end of the function, I would do
For more details, see the doc on Access Data in a Cell Array and Store or retrieve GUI data.