Loop input variables into function to get the various output in table
Mostrar comentarios más antiguos
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 comentarios
Adam Danz
el 18 de Jul. de 2022
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
el 18 de Jul. de 2022
That's helpful. How do those inputs map onto what the outputs should be?
IDN
el 18 de Jul. de 2022
Adam Danz
el 18 de Jul. de 2022
Where do those X,Y,Z values come from?
What should the program do?
IDN
el 18 de Jul. de 2022
Adam Danz
el 18 de Jul. de 2022
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
el 18 de Jul. de 2022
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Logical en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!