フィルターのクリア

Info

この質問は閉じられています。 編集または回答するには再度開いてください。

Function with a variable output

1 回表示 (過去 30 日間)
Patrick Aoun
Patrick Aoun 2016 年 5 月 24 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
Greetings,
I'm trying to create a function that imports data according to the input. If I input "A" I want it to import dataset "A" and add it in the workspace, with the name "A".
I tried creating a function with no outputs but that did nothing.
I was also thinking of creating a function whose output is variable. Something like:
switch Request
case "A"
output: A
case "B"
output: B
end
But I don't know what syntax to use there.
This would be simple if I use
output = A
But that would output a variable called "output" which is not what I want
Thanks in advance.
  1 件のコメント
Guillaume
Guillaume 2016 年 5 月 24 日
"But that would output a variable called "output" which is not what I want". It may not be what you want but, other than the poor name of the variable, it should be what you want.
It is much better to always import into the same variable, so that whatever code you're using to process the data afterward works regardless of its origin.

回答 (0 件)

この質問は閉じられています。

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by