Hi,
How do you change all values in the column of a vector using for loops? Like if i had a 10x10 matrix, how would I move the 10th column to the 1st column and the 9th column to the 2nd column and so on?

 채택된 답변

Walter Roberson
Walter Roberson 2021년 3월 28일

1 개 추천

Loop over the source column
destination_column = some function of source column
new_matrix(:,destination_column) = old_matrix(:,source_column);

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by