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
1 次查看(过去 30 天)
显示 更早的评论
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);
0 个评论
采纳的回答
Walter Roberson
2018-3-5
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.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Structures 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!