cellfun 함수
cellfun
Apply function to each cell in cell array
------------------------------------------------------------------------------------------------------------------------------------
내가 알고 싶었던 것은
ims = cellfun(@(x)fullfile(classes{ci},x),{ims.name},'UniformOutput',false) ;
이것이 어떻게 해석이 되는 것일까...?
------------------------------------------------------------------------------------------------------------------------------------
인터넷에 친절하게 예까지 나와 있어 이해하기 쉬웠다.!!
Create a cell array that contains strings, and abbreviate those strings to the first three characters. Because the output strings are nonscalar, setUniformOutput to false.
days = {'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday'};
abbrev = cellfun(@(x) x(1:3), days, 'UniformOutput', false)
The syntax @(x) creates an anonymous function. This code returns
abbrev =
'Mon' 'Tue' 'Wed' 'Thu' 'Fri'
내가 사용한 것은 fullfile 함수를 사용해 전체 주소를 불러 왔으니까
so~! cellfun함수가 각 셀행렬로 그 주소를 저장하는 것이구나~!!