MATLAB Answers

How to display values from MATLAB standalone windows deployment executable?

12 views (last 30 days)
Surjya padhi
Surjya padhi on 25 Jun 2014
Answered: Martin Lechner on 8 Oct 2020
I have created a matlab script file as follows
function MyWorld
var1 = [9 10];
var2 = 5;
disp(var2)
disp(var3)
It works and displays value of var1 and var2 in MATLAB terminal. Now for deployment I choose the windows standalone exe. I got the .exe file and run it on windows command terminal, but did not get any output.
Please suggest anywhere I am wrong...

Answers (2)

Martin Lechner
Martin Lechner on 8 Oct 2020
I had the same problem but I found a solution to redirect the output to a file
MyWorld.exe >output.log
It's also possible to redirect the standard error to a file
MyWorld.exe >output.log 2>error.log

Ben11
Ben11 on 25 Jun 2014
My guess would be that the "disp" command is only used to display stuff in the command window in the Matlab environment; for a standalone application you might want to display a message or something like this. Or you could build a simple GUI which would display your variables.
  2 Comments
Ben11
Ben11 on 26 Jun 2014
What if you use this:
function MyWorld
var1 = [9 10];
var2 = 5;
Message = sprintf('My variables are var1: [%i %i] and var2: %i \n',var1(1),var1(2),var2);
msgbox(Message)

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!