필터 지우기
필터 지우기

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 (최근 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);

채택된 답변

Walter Roberson
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 CenterFile Exchange에서 Structures에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by