operand (&&) error when trying to set a parameter
2 views (last 30 days)
Show older comments
I have a block of code that evaluates one matrix, BOX, with anohter matrix, TruveValMat. each of these has 8 values that need to be compared, when they all come back as equal, it enables a button on a GUI:
if strcmp(TrueValMat{1,1}, BOX(1,:)...
&& strcmp(TrueValMat{1,2}, BOX(2,:))...
&& strcmp(TrueValMat{1,3}, BOX(3,:))...
&& strcmp(TrueValMat{1,4}, BOX(4,:))...
&& strcmp(TrueValMat{1,5}, BOX(5,:))...
&& strcmp(TrueValMat{1,6}, BOX(6,:))...
&& strcmp(TrueValMat{1,7}, BOX(7,:))...
&& strcmp(TrueValMat{1,8}, BOX(8,:)))
set(handles.certifyButton, 'enable', 'on');
I am now getting this error when I run I get up to this part:
Operands to the logical and (&&) and or (||) operators must be convertible to logical scalar values.
is there any way to fix this error?
0 Comments
Answers (1)
Image Analyst
on 2 May 2021
Simply use isequal():
if isequal(TrueValMat, BOX)
handles.certifyButton.Enable = 'on'; % Using new and modern OOP way instead of old set() way.
end
2 Comments
Image Analyst
on 3 May 2021
Please attach TrueValMat, BOX in a .mat file so people can try things.
save('answers.mat', 'TrueValMat', 'BOX');
Attach a screenshot of your "indicator".
See Also
Categories
Find more on Software Development Tools in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!