Beginner at Matlab. Let's say I have a matrix
A = [ 2,3,4;
6,9,1;
7,8,3;
2,2,2 ]
I want to manipulate each column into a new column (of potentially different size) and then I want to have the whole new matrix. As an example, suppose I want to get rid of every number less than 4 and raise every other number to the fourth power. This is much simpler than what I'm actually trying to do so don't read too much into those specifics.
If I were to do it for a specific column, say the first one, I would do
newcolumn=[];
for r=1:4
if A(r,1)<4
newcolumn=newcolumn
else
newcolumn=vertcat(newcolumn,(A(r,1))^4))
end
end
Is it possible to do a double for loop to create the whole matrix?
Thanks
[6 7 9 8 4]. Now how to arrange it in a new matrix? - Autonomous