Problem with cell2mat "Cannot support cell arrays containing cell arrays or objects."

I am trying to run a pseudocode, which needs to run on a complete dataset of images. Name of the dataset is MICC-F220. The path of the dataset is 'C:\Users\parminder\Downloads\sift-forensic-master\sift-forensic-master\dataset'. I have following lines to process each image of the dataset.
% RUN EXPERIMENT
tstart = tic;
% dataset
DB = 'MICC-F220';
db_dir ='C:\Users\parminder\Downloads\sift-forensic-master\sift-forensic-master\dataset';
file_ground_truth = 'groundtruthDB_220.txt';
% parameters
metric = 'ward';
th = 2.2;
min_pts = 4;
% load ground truth from a file
[ImageName, GT] = textread(fullfile(db_dir,DB,file_ground_truth), '%s %d');
num_images = size(ImageName,1);
fid_gt = fopen(fullfile(db_dir,DB,file_ground_truth));
C = textscan(fid_gt, '%s %u');
fclose(fid_gt);
TP = 0; % True Positive
TN = 0; % True Negative
FP = 0; % False Positive
FN = 0; % False Negative
for i = 1:num_images
%parfor i = 1:num_images % use for parallel computation (needs matlabpool)
loc_file = fullfile(db_dir,DB,cell2mat(ImageName(i)));
name = cell2mat(ImageName(i));
% process an image
fprintf('Processing: %s (%d/%d)\n',loc_file,i,num_images);
countTrasfGeom = process_image(loc_file, metric, th, min_pts, 0);
......and so on
I am getting the following error
>>run_F220_experiment
Error using cell2mat (line 53)
Cannot support cell arrays containing cell arrays or objects.
Error in run_F220_experiment (line 30)
loc_file = fullfile(db_dir,DB,cell2mat(ImageName(i)));
How can i resolve it.

 採用された回答

Image Analyst
Image Analyst 2015 年 5 月 2 日
編集済み: Image Analyst 2015 年 5 月 2 日

0 投票

Maybe ImageName is already a string and you don't need cell2mat. Or maybe you can do char(ImageName{i}) or ImageName{i} (braces instead of parentheses). See the FAQ: http://matlab.wikia.com/wiki/FAQ#What_is_a_cell_array.3F.

3 件のコメント

harpreet
harpreet 2015 年 5 月 2 日
Thank you image analyst Error resolves using 'ImageName{i}'.
Akshay Koli
Akshay Koli 2020 年 1 月 5 日
編集済み: Akshay Koli 2020 年 1 月 5 日
hey..could you solve your problem of running this code ? @harpreet
Image Analyst
Image Analyst 2020 年 1 月 5 日
Apparently so, since he accepted my proposed solution.

サインインしてコメントする。

その他の回答 (1 件)

Matt J
Matt J 2015 年 5 月 2 日

0 投票

It is complaining that ImageName(i) does not contain a data type that cell2mat can handle. Check the content of ImageName{i} and re-evaluate whether cell2mat is the appropriate tool.

2 件のコメント

harpreet
harpreet 2015 年 5 月 3 日
thanks Matt J
Faiza Bukenya
Faiza Bukenya 2016 年 4 月 13 日
Thanks Matt

サインインしてコメントする。

カテゴリ

ヘルプ センター および File Exchange で Programming についてさらに検索

製品

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by