0
我有一個MATLAB中的圖像輪廓數據結構。如下所示:提取結構數據,以可變大小的矩陣分配它們
s =
1x59 struct array with fields:
level
numel
xdata
ydata
%s(k).level contains the contour level height of the k-th line.
% s(k).numel contains the number of points describing the k-th line.
% sk).isopen is True if the k-th contour is open and False if it is closed.
% s(k).xdata contains the x-axis data for the k-th line as a column vector.
% s(k).ydata contains the y-axis data for the k-th line as a column vector
我必須將s(k).xdata和s(k).ydata提取到可變大小的矩陣中。這是我製作的程序
for k=1:59;
if (k==1);
i(k)=s(k).numel;
[i,2]=size(S{k}(:,:));
x=s(k).xdata;
y=s(k).ydata;
S{k}(:,:)=[x y];
elseif (k>1 && k<=59)
i(k)=s(k).numel;
l=i(k-1)+i(k)
[i,2]=size(S{k}(:,:));
x=s(k).xdata;
y=s(k).ydata;
S{k}(:,:)=[x y];
S(:,:)=[S{k-1}(:,:);S{k}(:,:)];
end
end
???錯誤:多個LHS分配的數組不能包含數字值
任何人都可以幫助我嗎? 非常感謝你提前!
非常感謝您的幫助! –