Unable to assign result from function to variable
Mostrar comentarios más antiguos
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 comentarios
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
el 26 de Feb. de 2015
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Matrix Indexing en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!