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

4 次查看(过去 30 天)
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 个评论
Stephen23
Stephen23 2018-3-12
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

请先登录,再进行评论。

采纳的回答

Stephen23
Stephen23 2018-3-12
编辑:Stephen23 2018-3-12
After the loop:
M = cell2mat(cellfun(@(m)m(:),I(:).','uni',0))

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Multidimensional Arrays 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by