How do I combine matrices in a specific order?
Afficher commentaires plus anciens
for j=1:5
k=num2str(j); extension='.asc';
filename=strcat('Image',k,extension)
[Profiles]=readProfiles(filename); % Read profiles
ProfilesALL(:,j)=Profiles;
end
ProfISO_2_5=(ProfilesALL(:,1)+ProfilesALL(:,2))/2;
ProfISO_7_5=(ProfilesALL(:,2)+ProfilesALL(:,3))/2;
ProfISO_15=(ProfilesALL(:,3)+ProfilesALL(:,4))/2;
ProfISO_25=(ProfilesALL(:,4)+ProfilesALL(:,5))/2;
How do I occupy a new matrix, A, to be in this order:
A(:,1)=ProfilesALL(:,1);
A(:,2)=ProfISO_2_5;
A(:,3)=ProfilesALL:,2);
A(:,4)=ProfISO_7_5;
A(:,5)=ProfilesALL(:,3);
A(:,6)=ProfISO_15;
A(:,7)=ProfilesALL(:,4);
A(:,8)=ProfISO_25;
A(:,9)=ProfilesALL(:,5);
3 commentaires
Matt Kindig
le 4 Avr 2013
The code you presented to define A is fine. I suppose you could make it slightly shorter with:
A(:,1:2:9) = ProfilesALL(:,1:5); %odd columns only
A(:,2:2:8) = [ProfISO_2_5, ProfISO_7_5, ProfISO_15, ProfISO_25];
Jan
le 4 Avr 2013
A vote for Matt's answer, although it is hidden in the comment section.
Yun Inn
le 4 Avr 2013
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Logical dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!