对于'struct'类型的输入参数,如何处理错误'未定义函数'次'。

时间:2016-09-27 00:54:30

标签: matlab

一个以前工作了大约6个月的matlab程序已经开始给出错误

'未定义的函数'times'用于'struct'类型的输入参数。'出现的行是

sampleData.allDiameters= sampleData.allDiameters* pixelToMicron;

当我尝试循环或保存为其中一个结构字段的另一个变量之类的方法时,它会将新变量保存为结构,而以前它没有这样做。一些例子:

for n=1:length(measurements)
    x=measurements(n); %saves x as 1x1 struct
    measurements(n)=x*pixelToMicron;
end 

%%%

measurements=sampleData.allDiameters; %saves measurements as a 276x1 struct

这是在添加了一个小循环后触发的,此循环已被删除。这是一个while循环,甚至没有被包含在主程序中。没有其他人被编辑过。为清楚起见,这是循环(据我所知)

function [sampleData]=sphereCheck(sampleData)
%for each object check how spherical each object is 

%Measurement2: use regionprops to measure and record the x and y position
%of the corner of the smallest box which bounds the object [xpos ypos xwidth       ywidth]
measurements2=regionprops(sampleData.binImage, 'BoundingBox');
sampleData.allDiameters


counter=1
while counter<length(measurements2)
%[~ ~ a b]=measurements2(counter);

end 

我想知道如何让结构再次成倍增加或如何从结构中访问数据以对其执行操作。

0 个答案:

没有答案