![i1.png](https://www.mathworks.com/matlabcentral/answers/uploaded_files/223831/i1.png)
Help Writing One's Own Functions
1 次查看(过去 30 天)
显示 更早的评论
Writing a function in MATLAB was clear enough, but I ran into a little issue I want to correct. When I wrote functions in the past, I was doing them to test a program. The newest function I wrote actually computes something within a program - and it works. The issue I have is calling the function.
With a built-in MATLAB function, say isnan, in the command prompt I can write
M = isnan(A)
for some array A. Then immediately M will be the result of the operation isnan(A).
When I wrote a function, let us call it modify. When I try
M = modify(A)
in the command prompt, I am given the following error
Error using modify
Too many output arguments.
I don't do anything at the end of my function. It ends with a loop. How can I modify my function so that I can assign to it any variable name? I want to be able to perform the same variable assignment on my function as 'M = isnan(A)' above.
0 个评论
采纳的回答
KALYAN ACHARJYA
2019-6-10
I have tried with similar, I have no issue
![i1.png](https://www.mathworks.com/matlabcentral/answers/uploaded_files/223831/i1.png)
If I misundestood the question, please clarify?
3 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!