MATLAB: Help inserting character information into matrix

charactermatrices

Hey everyone, pretty new user here, so I'm probably overlooking an easy solution. I'm trying to extract subject information (subject name=character and weight=number) into a two column matrix. Below is the code I've been trying to use:
Code
list=dir('C*0*');
weights={}
for m=1:length(list)
cd(fullfile(list(m).name,'MR','MPRAGE'));
dcmlist=list('*.dcm');
A=dicominfo(dcmlist(m).name);
weights{m,1}=list(m).name
weights{m,2}=A.PatientWeight
if true
% code
end
clear A
end
What I can't understand, is that when I do this manually (insert one variable into the matrix at a time) it seems to work, but when I evaluate the code as a whole, I get the "matrix dimensions exceeded" error. I've tried creating separate empty cell matrices for subject name and weight, and also changed the way the data is appended (from {m,1} to {1,m}), all to no avail. Any help is greatly appreciated!

Best Answer

What do you think this is supposed to do:
dcmlist=list('*.dcm');
??? list is a cell array of strings . It takes an index like 1,2,3,4, not a wildcard string.