请了多个学生标记图谱,由于matlab版本原因,2019版本的结果与其他不同。
含结构体的数据
需要的cell 数组
为此需要判断是否为结构体,以及是否存在空数据。为此设计了程序
%将原来标记的groundTruth合并 6.24
Rebar24 = table('Size', [227 2],'VariableTypes',{'cell','cell'},'VariableNames',{'filename','Rebar'}); %% table
%RebarTrainOrig = table('Size', [478 2],'VariableTypes',{'cell','cell'},'VariableNames',{'filename','Rebar'}); %% table
% figure, imshow(imread(gTruth1.DataSource{1}))
% height(gTruth1.DataSource) %89
Rebar24.filename=gTruth24.DataSource.Source;
kong=gTruth24.LabelData.rebar(74,:);% empty
for i=1:227
a=gTruth24.LabelData.rebar(i,:);% 是否为结构体
b=cell2mat(a);
if isstruct(b)
%b=cell2mat(a(1,:));
b= cat(1,b.Position);
end
% height(c);
% num2cell(c,2)
[r,~]=size(b);
if ~cellfun(@isempty,a) % 非空数组
Rebar24.Rebar(i)= mat2cell(b,r,4);
else
Rebar24.Rebar(i)=kong;% empty
end
end