Function in a for gives subscript error?
조회 수: 1(최근 30일)
표시 이전 댓글
lightworks 2013년 4월 15일
I have a function that works on it's own just fine, it's something like this:
file=['./corrcoef' num2str(id(k)) '.mat'];
... calculate some coeficients..
The script where I call the function later is something like:
...calculate arrays X and Y..
This is where I get the error: ??? Subscript indices must either be real positive integers or logicals.
I'm really lost since the function works perfect in the script if I don't call it as a function (copy-paste the code of the function).
What am I doing wrong and how can I fix it?
Thanks in advance!
Walter Roberson 2013년 4월 15일
Do not assign the output of myfunc() to the variable named "myfunc" or else it ceases to be a function reference in that workspace.
Find more on Entering Commands in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!