MATLAB Answers

How to loop over column?

1 view (last 30 days)
dwi maulida
dwi maulida on 29 Apr 2021
Answered: VBBV on 29 Apr 2021
i have matrix input(4,12). i want to do loop over column but it only work for last column.
how do i get the loop correctly?
for j=1:12
xaij1=((input(:))-min(input(:,j)))/(max(input(:))-min(input(:)));
xaij=reshape(xaij1,[4,12]);
end

Answers (1)

VBBV
VBBV on 29 Apr 2021
%if true
for j=1:12
xaij1(:)=((input(:))-min(input(:,j)))/(max(input(:))-min(input(:)));
xaij(:,j)=reshape(xaij1,[4,12]);
end

Community Treasure Hunt

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

Start Hunting!

Translated by