Hi everyone, I am using nested if statements to perform a subsection of my project but i don't like the way i have implemented it. I am sure that there will be some optimum way of doing the following task, so to avoid so many if statements. Thank you so much.
if any(idcabs==[1 2 3 4]) if any(idabs==[1 2 5 6 9 10 13 14]) idbeam1=1; else idbeam1=3; endelseif any(idcabs==[5 6 7 8]) if any(idabs==[1 2 5 6 9 10 13 14]) idbeam1=3; else idbeam1=1; endelseif any(idcabs==[9 10 11 12]) if any(idabs==[1 2 3 4 5 6 7 8]) idbeam1=2; else idbeam1=4; endelseif any(idcabs==[13 14 15 16]) if any(idabs==[1 2 3 4 5 6 7 8]) idbeam1=4; else idbeam1=2; endend
Best Answer