Unable to assign result from function to variable
显示 更早的评论
I recently made a function to perform Gaussian Elimination on a matrix, then calculate its determinant if it exists.
It works perfectly fine if I simply call the function. However, the odd part is that I get the "output argument not assigned" error if I attempt to store the result as a variable.
Initialising the output variable to 0 within the function before it gets assigned its actual value returns both numbers, in spite of the output variable being double rather than a vector. Initialising it before declaring my persistent variables makes it worse; it returns three zeroes along with the actual value instead. If I attempt to store the output of the function as a variable after performing this initialisation, it only stores one of the values.
Note that the output variable in the function remains double within the function the entire time. Oh, and I suppose I should mention that the error occurs in the line where I declare the persistent variables. Could that be causing the problem? It's the crux of the code though...
2 个评论
If you don't actually post the code, how are we supposed to know what is happening? We have not yet learned to read minds, and surprisingly we also can't read your computer monitor
If you actually want help with this, you need to help us by giving useful information:
Please edit your question to give the exact code that you are using. You can either include this within the text of your question (please format it correctly using the {} Code button) or if it is large then upload it as a file (use the paperclip button).
It would also be useful if we know exactly how you are calling your function.
Joshua
2015-2-26
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!