In a directory I have a collection of 20 files. I want to:
- iterate a loop across those 20 files,
- extract
xandydata from them and - place those data in a 2D matrix that is created within the loop
Note below that files' is a 20x1 struct and file is a 1x1 struct.
I'm unsure how to build the 2-dimenstional matrix A inside such a loop.
I've tried something like
files = dir('./cases/*.dcm');
for file = files'
[data extraction here, creating vars x and y]
for k = 1:length(files')
A(k,:) = (x:y);
end
end
but I get
Subscripted assignment dimension mismatch.
Any idea what I'm doing wrong?
XandYare just one number each? If so tryfiles = dir('./cases/*.dcm');for k = numel(files);file = files(k);[data extraction here, creating vars x and y];A(k,:) = [x,y];end.