How can i use datastore (mat-files) in map function?

조회 수: 2 (최근 30일)
Alireza PS
Alireza PS 2016년 5월 31일
편집: Alireza PS 2016년 6월 4일
I have 2000 images, and each of them has a mat-file with the following matrices(struct) as image info:
the struct for each image is ( x is variable for each images):
desc: [x * 128 double]
locs: [x * 4 double]
color_hist: {1 * x cell}
color_hist has x vectors as [1 * 11 double]
I used the following statement for creating datastore:
ds = fileDatastore(fullfile(pwd,'property'),'ReadFcn',@load,'FileExtensions','.mat')
Now, i want to compare the first image info with another images, but i don't know how can i access images info in map function, separately, for comparing images.
for example, the following map function :
function maxMapper(data, ~, intermKVStore)
t = data.desc;
struct(t)
end
output is:
Error using maxMapper (line 7)
Reference to non-existent field 'desc'.
Error in mapreduce (line 99)
outds = execMapReduce(mrcer, ds, mapfun, reducefun, parsedStruct);
Error in MapReduce (line 151)
result = mapreduce(ds, @maxMapper, @maxReducer);
Is there a nice way to do this?

답변 (0개)

카테고리

Help CenterFile Exchange에서 MapReduce에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by