Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID

Categories

We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact lee@programmersheaven.com if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Help needed with nested conditional running through nested loop

TastyPITastyPI Posts: 2Member
First off let me say thanks to anyone taking the time to look at this thread. It is my first time getting on a forum and i am not really sure how to start. Also i should say i am extremely new at matlab and programming in general.

My code:
num_rows=input('enter the number of rows: ');
for l=0:((2^(num_rows^2))-1);
tleft = de2bi(l,(num_rows^2),2,'left-msb');
A = vec2mat(tleft,num_rows)
for i=1:1:num_rows
for j=1:1:num_rows
for k=1:1:num_rows
if A(i,j)==1
if A(j,k)==1
if A(i,k)==1
disp 'true';
else
disp 'false';
end
else
disp 'true';
end
else
disp 'true';
end
end
end
end
end

What i want to do is if there is a false at all then just display one false. If a false does not occur then display one true. I Would advise running this code with input 2 to see what is going on, since input 3 will give you 512 matrices and so on and so forth.


Sign In or Register to comment.