Undefined function "name_function" for input argurments od type "cell"
1 次查看(过去 30 天)
显示 更早的评论
[m, n] = size(app.Vectores.Data);
app.DatosBase = app.Vectores.Data;
d = cell(m + 1, n);
d(1:m, 1:n) = app.DatosBase;
app.Vectores.Data = d;
data=get(app.Vectores,'data');
X=[]
Y=[]
Z=[]
TF=[]
X1=[]
Y1=[]
Z1=[]
for i=1,m
L=[data(i,2);data(i,3);data(i,4);1]
X=[X,(X1+data{i,2})]
Z=[Z,(Z1+data{i,4})]
X1=X1+data{i,2};
Y1=Y1+data{i,3};
Z1=Z1+data{i,4};
if rot(i,2)==0
RBA=[cosd(rot(i,1)),-sind(rot(i,1)),0;sind(rot(i,1)),cosd(rot(i,1)),0,0,0,1];
else
RBA=[sind(rot(i,2))*cosd(rot(i,1)),sind(rot(i,2))*(-sind(rot(i,1))),cosd(rot(i,2));cosd(rot(i,2))*cosd(rot(i,1)),cosd(rot(i,2))*sind(rot(i,1)),- sind(rot(i,2));-sind(rot(i,1)),cos(rot(i,1)),0];
end
T=[RBA,tras(i,:)';0,0,0,1];
TF=[TF,T];
if i==1
TP=T;
M=L
elseif i==m
TP=TP
M=TP*L
PZ=[PZ,M];
else
M=TP*L;
PZ=[PZ,M];
TP=T*TP;
end
set(app.Matrices,'data',TP)
end
0 个评论
回答(1 个)
SAI SRUJAN
2023-12-28
Hi Sebastain,
I understand you are facing an issue with an undefined function error in MATLAB.
The error message "Undefined function 'name_function' for input arguments of type 'cell'" suggests that MATLAB cannot find a function called 'name_function' that accepts cell array inputs.
Upon reviewing the provided code, there seems to be an inconsistency in the indexing methods used. In MATLAB, curly braces '{}' are utilized for accessing elements within cell arrays, while parentheses '()' are used for indexing numerical arrays. The code should use consistent indexing based on the type of data. The lines of code provided in the snippet may be the source of the encountered error,
L=[data(i,2);data(i,3);data(i,4);1]
X=[X,(X1+data{i,2})]
Z=[Z,(Z1+data{i,4})]
Moreover, when invoking the get function in MATLAB to query a specific property, the output is typically returned as a struct or a cell array. To proceed and address the current issue, it is advisable to modify the function declaration to accept input parameters of type cell or struct.
For a comprehensive understanding of the 'get' function in MATLAB, please refer to the following documentation.
I hope this helps.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!