Loop input variables into function to get the various output in table
显示 更早的评论
Hello!
I have a function for which i have some variables as input that create output as follows:
function(A,B,C,D,E,F,G) - So I input varibles A thru G and get the below output X thu Z
for i = 1:varout
switch i
case 1
varout{1} = X;
case 2
varout{2} = Y;
case 3
varout{3} = Z;
end
I have for example the following input variables I want to pass thru the function all at once for me to get a table with all the output variables given the input.
A B C D E F G X Y Z
1 2 1 2 6 7 1 =
3 1 1 8 7 4 10 =
1 5 1 2 6 3 8 =
Appreciate all the help in this matter! Thanks so much!
8 个评论
Adam Danz
2022-7-18
The question/goal is not clear.
I see you're using varout which suggests you expect a variable number of outputs. But you mention that the output should be a table so it's not clear how that all ties together.
Also, what are A,B,C,...,G? Could you provide examples of these inputs?
I have a feeling you're working with a variable number of inputs and want a single output variable that is a table containing the columns from your key when given the input variables. Is that right?
Adam Danz
2022-7-18
That's helpful. How do those inputs map onto what the outputs should be?
IDN
2022-7-18
Adam Danz
2022-7-18
Where do those X,Y,Z values come from?
What should the program do?
IDN
2022-7-18
Adam Danz
2022-7-18
That should be easy to implement. If those are your variable names, then that's exactly the code you would use to produce those outputs. But I must admit, I am still quite uncertain of the goal.
IDN
2022-7-18
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!