Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X
Good morning,
I have been working in a problem that requires several steps in one function. Is like creating several tables and each one with specific information. At the end, my interest is the final value of one of those "tables", but it would be nice if I can show the result of the others tables (the entire table). Please see attached example, to understand a little bit more my issue: There are two functions ("Func" and "Func2" they are the same but they have a different return) with a loop. In each iteration I am creating a new row of each "table", and using that information I estimate the next. The tables should handle units, so that's why I use arbitrary units in this example.
My question is: as you can appreciate I use two functions to get the required value and the "other tables", but they are actually the same. do you know if there is any way I can get all (value and "tables") from the first function? something like multiple return?
Thanks a lot,
OJ.
Solved! Go to Solution.
something like multiple return?
No, just one return value allowed, but you can put all you want to return in a vector or matrix. But as you probably know you would have to take care that all matrix elements must have the same unit (or none).
Maybe something like the attached would help?
EDIT: Added a third method at the end
something like multiple return?
No, just one return value allowed, but you can put all you want to return in a vector or matrix. But as you probably know you would have to take care that all matrix elements must have the same unit (or none).
Maybe something like the attached would help?
EDIT: Added a third method at the end
Hello Werner,
Thanks for your reply. It was really helpfull.
I was thinking of adding a second parameter to my function, so I can decide what to return based on that. Please see document attached.
Best,
OJ
I was thinking of adding a second parameter to my function, so I can decide what to return based on that.
Nice touch!