MATLAB: Using a cell array and a for loop

cell arrayfor loop

Hey guys, I have to do a cell array to strore some information about an animal and use a for loop to display that information and the result should look like this:
Identification number: 1
Gender: M
Weight: 400
Age: 4
Treatment: 0
I've tried many thing and I dont get how to have to columns. This is what i've tried.
rat_cell = {'number', 'sex', 'weight', 'age', 'treatment', 1, 'M', 400, 4, 0};
for i = 1:5
disp(rat_cell(i,:))
     for j = 1:5
     disp (rat_cell (j,:));
end
end
I dont get why it doesnt show 2 columns like its supposed to. Thanks

Best Answer

You can use you code with a little modification: First of all, you're showing first cell and then 5 cell from the beginning. This is not what you want.
rat_cell = {'number', 'sex', 'weight', 'age', 'treatment'; '1', 'M', '400', '4', '0'}; % Note I changed the numbers to string
for j = 1:5
disp([rat_cell{1,i} ': ' rat_cell{2,i}]);
end