Parentheses error with a function call
8 次查看(过去 30 天)
显示 更早的评论
What is wrong with this function call? It's so basic but don't know what I am missing.
The error is "Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters."
load('mnist.mat', 'testX');
% save('testX'); commented it based on the reply I got for this question
x=testX; % testX is a 529*784 matrix
k=5; numIter=6;
[mu, cll, ill] = gmm(x, k,numIter)
% the function definition starts like this in another file
% function [mu,CLL,ILL] = gmm(x,K,numIter)
4 个评论
Walter Roberson
2021-5-10
I do not see any problem with the code extract that you posted.
Perhaps the error is inside gmm function .
采纳的回答
VBBV
2021-5-11
%if true
x = load('mnist.mat', 'testX');
k=5;
numIter=6;
function [mu, cll, ill] = gmm(x, k,numIter)
Assign x directly when loading
4 个评论
Walter Roberson
2021-5-11
Assigning the output of load() is a good idea... it just isn't the reason you had the problem in this situation, and the change was not coded for correctly in VBBV's answer.
更多回答(1 个)
Walter Roberson
2021-5-11
[copying down from correct comment]
I do not see any problem with the code extract that you posted.
Perhaps the error is inside gmm function .
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!