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 Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by