Unexpected error in a pushbutton function.
Show older comments
I have the following code in a pushbutton function:
pixel = uigetfile('*.jpg');
K = imread(pixel);
[row col] = size(K);
Kmm = 1/col
setappdata(0, 'Kmm', Kmm);
guidata(hObject, handles)
After that, I wanna go to another pushbutton which has the following code in some part of it:
Kmm = getappdata(0, 'Kmm');
reg_prop = regionprops(wat, 'all');
for i=1:smax;
Area_surface(i) = reg_prop(i).Area;
end;
max_area = max(Area_surface);
min_area = min(Area_surface);
sum_Area_surface = sum(Area_surface);
diamerisi_area = 6;
omega = zeros(1000,1);
for i=1:smax
Area_surface(i) = Area_surface(i)*Kmm^2;
bin(i) = int16(Area_surface(i)*10 + 1);
omega(bin,1) = omega(bin,1)+1;
end
When it runs I get the following message:
??? In an assignment A(I) = B, the number of elements in B and
I must be the same.
Error in ==> lets_see>pushbutton7_Callback at 331
Area_surface(i) = Area_surface(i)*Kmm^2;
Error in ==> gui_mainfcn at 96
feval(varargin{:});
Error in ==> lets_see at 42
gui_mainfcn(gui_State, varargin{:});
Error in ==>
@(hObject,eventdata)lets_see('pushbutton7_Callback',hObject,eventdata,guidata(hObject))
??? Error while evaluating uicontrol Callback
I can't understand why the number of elements is not the same.
Accepted Answer
More Answers (0)
Categories
Find more on Other Formats in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!