From: Kenan on
Hi everyone!

I want to create a Yes - No dialogbox within my .m code. I've made it using a "while" loop. There is no problem if you choose "Yes" on the dialog box. But i get this error when i choose "No":

??? Error using ==> eq
Matrix dimensions must agree.

Error in ==> sayisal2 at 175
while choice=='Yes'

Here is the whole code. This is a code which shows the rows of the matrix begin with the number defined by user:

A=[19 20 26 28 31 46;
9 11 14 31 40 45;
1 6 14 27 39 49;
13 21 26 27 33 47;
8 12 15 17 27 31;
22 23 24 25 40 47;
2 7 18 22 36 37];

a=input('Write the first number: ');
while a==0 | a>49
a=input('Please enter a number between 0 and 49 ');
end
Z=A(A(:,1)==a,:)
disp(Z)
disp([num2str(size(Z,1)) ' matches found.'])
str='Do you want to try again?';
choice=questdlg(str,'New process','Yes','No','Yes');

while choice=='Yes'
a=input('Write the first number: ');
while a==0 | a>49
a=input('Please enter a number between 0 and 49 ');
end
Z=A(A(:,1)==a,:);
disp(Z)
disp([num2str(size(Z,1)) ' matches found.'])
str='Do you want to try again?';
choice=questdlg(str,'New process','Yes','No','Yes');

end

Any help would be appreciated. Thanks in advance.
Kenan
From: ImageAnalyst on
Kenan
Try using strcmpi(choice, 'yes') instead of choice == 'Yes'


From: Kenan on
ImageAnalyst <imageanalyst(a)mailinator.com> wrote in message <09dd3398-293e-4353-8b63-bf508655a305(a)d12g2000vbr.googlegroups.com>...
> Kenan
> Try using strcmpi(choice, 'yes') instead of choice == 'Yes'
>
Thanks a lot. It works.