Using publish from within a GUI

Hello all,
This is my first time asking, so I hope I include everything needed. Presently I am trying to add a button to an existing GUI that creates an html data report and saves it using the publish command. I have been able to do this somewhat successfully, in that figures I have generated have saved to the appropriate areas and the folders are being created. The problem comes when trying to use 'opts.codeToEvaluate' to grab values that have been evaluated.
For example, suppose my function with markups and such is called test.m and it has an input called 'value'. Suppose also that I want to pass to it 'mu' to take the place of 'value'. Since 'mu' will change each time the button is pushed, I want to type in one command
opts.codeToEvaluate = 'value=mu; test(value)';
publish('test',opts);
If I do this, however, I get an "Error using evalin, the variable mu is not defined".
If more details or information is needed please let me know. I look forward to hearing some solutions. (I have thought of using the 'set' function, but not sure if it will work any better).
Ben

2 件のコメント

Esben
Esben 2012 年 3 月 21 日
Hey
I'm new to this publish funtion. It seems very simple when I have script file from which i want a report.
But I am currently working with a GUI and would really like to make a buttom that would generat a repport of say a figure and a value of a variable.
Could you give a hint on how to do that?
Kaustubha Govind
Kaustubha Govind 2012 年 3 月 22 日
Esben: I think you should create a new question so more users will be notice it and might be able to help you out. Comments are not a good place to ask questions unless you are asking for clarification on what the poster said.

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

 採用された回答

Kaustubha Govind
Kaustubha Govind 2011 年 5 月 9 日

1 投票

My guess is that PUBLISH is looking for 'mu' in the base workspace instead of the GUI workspace. You could try creating 'mu' in the base workspace and see if that works:
assignin('base', 'mu', mu);

1 件のコメント

Ben
Ben 2011 年 5 月 9 日
Thank you very much, this solution worked perfectly. Now the GUI is auto-creating data files for an entire matrix of initial conditions. Have a good day.

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeStartup and Shutdown についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by