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

10 次查看(过去 30 天)
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
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 个评论

请先登录,再进行评论。

更多回答(1 个)

Matt J
Matt J 2015-5-2
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.

类别

Help CenterFile Exchange 中查找有关 Matrix Indexing 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by