olamundo
olamundo

Reputation: 24991

run matlab script from gui

I want to run a script by pressing a button in the gui.

But I want it to be as though I ran the script, i.e all variables created by it will be added to the workspace, it will be able to access any variables that are in the workspace etc.

Is this possible?

Upvotes: 0

Views: 1210

Answers (1)

pedrosorio
pedrosorio

Reputation: 870

There is a function written by John D'Errico: putvar. You can call it with all the variables you want to put in the base workspace and they will be put there from your function. You should call it at the end of your script.

If you look at the code it's not too hard to modify it to have a function that receives variables and reads all of them from the base workspace into your script. The two main functions that you will need to do this are evalin and assignin.

Upvotes: 1

Related Questions