Info

This question is closed. Reopen it to edit or answer.

hi-i have a one dimensional for loop and i need to change it to different dimensional?

1 view (last 30 days)
hi-i have a one dimensional for loop and I need to change it to different dimensional?
T=33; size EG is =786432*1;size KNM is 786432*33
Conter_EG=size(EG,1);
Co=zeros(Conter_EG);
for NM=1:Conter_EG
R_KNM=KNM(NM);
Co(NM)=GT_New(R_KNM);
end
Please can anyone tell me how to change the for loop - i am new in coding -many thanks

Answers (1)

Thorsten
Thorsten on 2 Jul 2015
Edited: Thorsten on 2 Jul 2015
If GT_New is defined to process 1X33 input, you replace the four line with
R_KNM=KNM(NM,:);
If you do not need R_KNM elsewhere, you can also replace the two lines in the for loop with a single one:
Co(NM)=GT_New(KNM(NM,:));

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!