Saving outputs in workspace

17 ビュー (過去 30 日間)
Ana Luisa
Ana Luisa 2012 年 11 月 21 日
When defining a menu, when you want to get outputs out of one case, in order to use them as inputs in another case, how can you save them in the workspace with a specific name?
Thankyou very much
  1 件のコメント
Jan
Jan 2012 年 11 月 21 日
What do you mean by "menu"? An entry in the menubar of the figure, or a list of buttons, or a menu in the command window, or a context menu? What is "one case" and how can another "case" have inputs? What is a "specific name" here? And do you mean the local workspace of a function, or the base workspace, which is e.g. active in the command line?

サインインしてコメントする。

採用された回答

Richard
Richard 2012 年 11 月 21 日
  1 件のコメント
Ana Luisa
Ana Luisa 2012 年 11 月 21 日
Thank you very much for your answer!

サインインしてコメントする。

その他の回答 (1 件)

Image Analyst
Image Analyst 2012 年 11 月 21 日
It's best not to do that. It's best to define a function and then have that function return output arguments which are then accepted and used by your main script or calling function
In function1.m or myscript1.m:
function function1() % Only used if it's a function, not if it's a script.
% Then (regardless if it's a function of a script), call it like this:
[out1 out2] = MyFunction(in1, in2, in3);
Then, in MyFunction, define it like this:
function [out1 out2] = MyFunction(in1, in2, in3)
% Code to create out1 and out2 from in1, in2, and in3
MyFunction can be inside function1.m if you're using a function. If the main routine is a script (no function keyword to start off the m-file), then you can't define MyFunction inside the "myscript.m" script m-file.
I suggest you read the documentation on how to use functions.
  1 件のコメント
Ana Luisa
Ana Luisa 2012 年 11 月 21 日
Thank you very much for your answer!

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeInteractive Control and Callbacks についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by