Azzera filtri
Azzera filtri

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

4 visualizzazioni (ultimi 30 giorni)
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 Commenti
Stephen23
Stephen23 il 12 Mar 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

Accedi per commentare.

Risposta accettata

Stephen23
Stephen23 il 12 Mar 2018
Modificato: Stephen23 il 12 Mar 2018
After the loop:
M = cell2mat(cellfun(@(m)m(:),I(:).','uni',0))

Più risposte (0)

Categorie

Scopri di più su Multidimensional Arrays in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by