필터 지우기
필터 지우기

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

조회 수: 4 (최근 30일)
kitty varghese
kitty varghese 2018년 3월 12일
댓글: kitty varghese 2018년 3월 12일
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