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

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

Réponses (1)

Thorsten
Thorsten le 2 Juil 2015
Modifié(e) : Thorsten le 2 Juil 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,:));

Cette question est clôturée.

Question posée :

le 2 Juil 2015

Clôturé :

le 20 Août 2021

Community Treasure Hunt

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

Start Hunting!

Translated by