From: Ish Khan on
Hi, I am doing a very basic programming to calculate the foot index of a given foot image, so after doing all the image processing and all, my program need to give a diagnostic of the foot type, so here is my code,

Z = get(handles.pushbutton1,'userdata');
if (Z < 0.21)
str = 'High' ;
elseif (Z >= 0.21)&& (Z <= 0.26)
str = 'Normal' ;
else
str = 'Low';
end
message = sprintf('Your Foot Arch Type is %s.',str);
reply = questdlg(message, 'Foot Type Test Results.', 'OK','Cancel', 'OK');
if strcmpi(reply, 'Cancel')
return;
end

when i try to run it in the GUI i get the error, ??? Operands to the || and && operators must be convertible to logical scalar values. which i comprehend as my Z values are not scalar, that is why the error, how can i avoid getting the error?
any advice is very much appreciated:)
From: ImageAnalyst on
Set a break point and see what Z is. Z is probably null or nan or
something unexpected )because you never assigned anything to the
userdata property of your pushbutton) and so Z<.21 is also null or nan
and thus your && operation fails because (Z<.21) is not a logical
From: Matt Fig on
It seems as though Z has many values. Thus you will have to figure out what you want to do about that. If you want it so that all of the values in Z have to pass each conditional, then use & (or the ALL function) instead of &&. If you want it so that any of the values in Z meeting the conditional will pass, use the ANY function to convert to scalar.
From: Ish Khan on
Thank you so much for the help:) it worked...