How to run a live task from the command line

I have created my own LiveTask (a simple UI for file and folder selection plus manipulation) for others to use in a livescript but I want to use it personally as an object that I call from a regular M-file.
I can call it directly and it fires up and all the interaction works etc and I can call the generateCode() method but how can I get the calculated values into my workspace?
Technically, I could probably put a call to "assignin" within my task or fiddle with some "eval" calls to process the generated code but I would like to try and keep my code clean and more "Matlab".

2 Comments

Thanks Stephen, that uiwait/uiresume process works a treat.

Sign in to comment.

 Accepted Answer

dpb
dpb on 2 Jul 2026 at 14:06
Edited: dpb on 2 Jul 2026 at 17:37
It must be a function (not a script) and have defined return variables to return them with ordinary function syntax. If will also then have to be constructed such that the top level function assigns the results from whatever functions it calls so they're in scope to be able to be assigned to the return variable(s) passed back to its caller (your m-file function or command line).
Failing that, it would take indirect transfer of one form or another, yes.

1 Comment

I get that only functions can return values but this is the case of an object (matlab.task.LiveTask) that includes a uifigure and various uicontrols. I suppose the real question is whether callback functions (eg. CloseRequestFcn) can return a value that I can continue to use after the handle to the Livetask object has been deleted?

Sign in to comment.

More Answers (0)

Categories

Find more on Migrate GUIDE Apps in Help Center and File Exchange

Products

Release

R2025b

Asked:

on 2 Jul 2026 at 7:54

Commented:

on 6 Jul 2026 at 6:40

Community Treasure Hunt

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

Start Hunting!