MATLAB: How to find the maximum element of each column of a cell array

cellarraymax

I have a cell array like this:
if true
ca={'x' 1 1 9 3;'y' 5 1 1 1; 'z' 5 7 5 9};
end
I have to find the max number of each column then divide all element of that column to maximum I wrote this code but it had errors:
if true
for j=2:3
max_column=max(ca(:,j));
for i=1:5
ca(i,j)= ca(i,j)/max_column;
end
end
disp(ca)
end
Please help me to edit this code. thanks in advance

Best Answer

Hi Afsane,
The first column of char elements have to be removed & then the cell needs to converted to a matrix. Then you can run the code.
ba={'x' 1 1 9 3;'y' 5 1 1 1; 'z' 5 7 5 9};
temp = [ba(:,2),ba(:,3),ba(:,4),ba(:,5)];
ca = cell2mat(temp)
for j=1:4
max_column=max(ca(:,j));
for i=1:3
ca(i,j)= ca(i,j)/max_column;
end
end disp(ca)