Azzera filtri
Azzera filtri

Struct contents reference from a non-struct array object... I have an error when I run below Matlab code, however I am running this code on the parallel pool. MATLAB2017b

2 visualizzazioni (ultimi 30 giorni)
function D = SvmSegm_extract_all_class_features_nofiles(exp_dir, img_name, mask_type, class_feats, delete_local_feats)
DefaultVal('delete_local_feats', 'true');
img_name = {img_name};
[meas_req, needs_shape, figure_ground, the_pars] = SvmSegm_get_measurements_required(class_feats);
%
% Histograms of gradients
%
parfor i=1:numel(meas_req)
filename = [exp_dir 'MyMeasurements/' mask_type '_' class_feats{i} '/' img_name{1} '.mat'];
if(~needs_shape(i))
filename = [exp_dir 'MyMeasurements/' meas_req{i} '/' img_name{1} '.mat'];
if(~exist(filename, 'file'))
SvmSegm_extract_measurements_new(meas_req{i}, img_name, exp_dir, inf);
end
else
if(~exist(filename, 'file'))
SvmSegm_extract_measurements_on_masks(mask_type, meas_req{i}, the_pars{i}, img_name, exp_dir);
end
end
end
%
% Bag of words
%
parfor i=1:numel(class_feats)
if(the_pars(i).isbow)
SvmSegm_get_bow_like_histograms_multiple_segments(mask_type, meas_req{i}, {figure_ground{i}}, img_name, exp_dir);
end
end
if(delete_local_feats)
for i=1:numel(class_feats)
if(the_pars(i).isbow)
filename = [exp_dir 'MyMeasurements/' meas_req{i} '/' img_name{1} '.mat'];
if(exist(filename, 'file'))
delete([exp_dir 'MyMeasurements/' meas_req{i} '/' img_name{1} '.mat']);
end
end
end
end
for i=1:numel(class_feats)
var = load([exp_dir 'MyMeasurements/' mask_type '_' class_feats{i} '/' img_name{1} '.mat']);
D{i} = var.D;
end
end
...............................................................
Error using SvmSegm_extract_all_class_features_nofiles (line 37)
Struct contents reference from a non-struct array object.
Error in cpmc>get_features (line 185)
D_2 = SvmSegm_extract_all_class_features_nofiles(exp_dir, img_name, mask_type, feat_types(recog_feats_in),
delete_local_feats);
Error in cpmc (line 132)
D = get_features(exp_dir, img_name, segm_pars.name, masks, segment_measurements);
Error in cpmc_example (line 33)
[masks, scores] = cpmc(exp_dir, img_name);

Risposta accettata

Walter Roberson
Walter Roberson il 5 Mar 2018
The line
SvmSegm_extract_measurements_on_masks(mask_type, meas_req{i}, the_pars{i}, img_name, exp_dir);
believes that the_pars is a cell array, but the line
if(the_pars(i).isbow)
believes that the_pars is a non-scalar struct.
Those two lines are only compatible if SvmSegm_extract_measurements_on_masks uses assignin('caller') to overwrite the_pars, or if SvmSegm_extract_measurements_on_masks is certain to error() before continuing.

Più risposte (0)

Categorie

Scopri di più su Structures in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by