Filter löschen
Filter löschen

how to read and stack the details in columns from a cell array?

4 Ansichten (letzte 30 Tage)
I want to read and stack all the values present in cell into a column. Such that the values present in cell 1 is stacked onto column 1 and so on...
Here is the code of how I loaded it into cell.
dicomlist = dir(fullfile('C:\Users\kitty\Dropbox\denoise_ksvd\','ADNI','*.dcm'));
for cnt = 1 : numel(dicomlist)
I{cnt} = dicomread(fullfile('C:\Users\kitty\Dropbox\denoise_ksvd\','ADNI',dicomlist(cnt).name));
end
  2 Kommentare
Stephen23
Stephen23 am 12 Mär. 2018
Rather than repeating a hard-coded path, just define it once:
P = 'C:\Users\kitty\Dropbox\denoise_ksvd';
S = dir(fullfile(P,'ADNI','*.dcm'));
I = cell(1,numel(S));
for k = 1:numel(S)
I{k} = dicomread(fullfile(P,'ADNI',S(k).name));
end

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Stephen23
Stephen23 am 12 Mär. 2018
Bearbeitet: Stephen23 am 12 Mär. 2018
After the loop:
M = cell2mat(cellfun(@(m)m(:),I(:).','uni',0))

Weitere Antworten (0)

Kategorien

Mehr zu Multidimensional Arrays finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by