Storing the absor function into my code gives ABSURD error
2 views (last 30 days)
Show older comments
Hi all
I was trying to store the absor function in my code, to avoid calling it from a separate m file. Strangely it worked fine as a separate m file but as soon as copying it into my code, It seems that matlab doesn't like it's last three functions and says they might not be used. when I try to run the code, it gives the error on dealr function.
Error: Undefined function 'dealr' for input arguments of type 'double'.
I still have not changed the way I use the absor function in the code as I wrote when I was calling it as an external mfile :
[regParams,Bfit,ErrorStats]=absor(A1,A2);
I don't know whether I should introduce
funx= @absor
and if so, how to change the function expression and still : what is that error , and if the function is not actually dealr but deal and there is a typo in the function name
but still : why was it working fine as a separate m file ?
0 Comments
Accepted Answer
Rik
on 20 Mar 2020
You need to close all your functions with the end keyword or none of them. Within the same file you cannot mix the two styles. My guess is that the file you pasted this in did already use end keywords for each function, and this absor function doesn't.
7 Comments
Walter Roberson
on 21 Mar 2020
You are mistaken, farzad.
I put the following code into a script:
N = 10;
A = randn(2, N);
B = randn(2, N);
[regParams,Bfit,ErrorStats]=absor(A,B);
disp(regParams)
disp(Bfit)
disp(ErrorStats)
followed by the code for absor taken from the File Exchange, except that I added an end statement corresponding to every function statement. The results looked fine to me.
Note that you have four functions for which end must be added.
More Answers (0)
See Also
Categories
Find more on Testing Frameworks 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!