I am a newbie to Matlab.Still trying to learn the syntax and everything.I have a large data matrix D.I am trying to remove part of the large matrix and make small matrices.I am searching the 3 columns and returning matrices which contain the numbers in the 3 columns.
BPI20 = D(D(:,1) == 0 &D(:,2)==0 &D(:,6)==20,:); BPI21 = D(D(:,1) == 0 &D(:,2)==0 &D(:,6)==21,:); BPI22 = D(D(:,1) == 0 &D(:,2)==0 &D(:,6)==22,:); BPI23 = D(D(:,1) == 0 &D(:,2)==0 &D(:,6)==23,:); BPI24 = D(D(:,1) == 0 &D(:,2)==0 &D(:,6)==24,:); I want to write a for loop for the above code where the value of the variable BPI should also increase Thank you
D(:,6look like?1:24?BPI18orBPI{18}ifD(18,1)~=0 or D(18,2)~=0? zeros? NaNs? empty? What do you want to do with it aftwerwards? Because you could potentially just simplify all your code above to:BPI = D(D(:,1)==0 & D(:,2)==0)BPI{1},BPI{2}, etc instead ofBPI1,BPI2, etc. Can you still tell us what you want to do with the resulting data? You know someBPI{ii}will be empty right? IfD(ii,1) == 0 &D(ii,2)==0is not satisfied,BPI{ii}will be empty!! That's not due to my code, it's also present in the code in your question..