Problem with cell2mat "Cannot support cell arrays containing cell arrays or objects."
Ältere Kommentare anzeigen
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.
Akzeptierte Antwort
Weitere Antworten (1)
Matt J
am 2 Mai 2015
0 Stimmen
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.
Kategorien
Mehr zu Matrix Indexing finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!