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

Respuestas (1)

Thorsten
Thorsten el 2 de Jul. de 2015
Editada: Thorsten el 2 de Jul. de 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,:));

La pregunta está cerrada.

Preguntada:

el 2 de Jul. de 2015

Cerrada:

el 20 de Ag. de 2021

Community Treasure Hunt

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

Start Hunting!

Translated by