What happens in response to fprintf commands when a deployed app is created using deploytool?

조회 수: 6 (최근 30일)
I am creating an App for others to use the matlab code, using deploytool. I have a couple of questions.
1. What happens if I am using the fprintf commands since there is no MATLAB window to print in response to this command?
2. My code runs fine in the MATLAB environment. However, when I run the app created by deploytool, it bombs with no indication of where it did so? How can I debug this error since debug flags cannot be used here?

채택된 답변

Benjamin Kraus
Benjamin Kraus 2017년 12월 26일
You can specify a file identifier (created using fopen) as the first input to fprintf, which will send the output to a file. If you don't specify the file, then fprintf should send all it's output to "standard out", which should be the command line you used to launch your App. If you started the App by double-clicking the executable, I don't believe the output is sent anywhere, so if you want to capture that output you need to start your App from a terminal or command window (the details depends on your operating system).
  댓글 수: 5
Ranjan Sonalkar
Ranjan Sonalkar 2018년 6월 5일
편집: Ranjan Sonalkar 2018년 6월 5일
It is related to the original question regarding how to interact with the App. I want the app to display instructions, so the user can act accordingly. I start the app from CMD window and I am still not getting the disp command in the code to display the instructions in the window. I also want the app to pause the program to allow the user to zoom into a figure. Then the user should be able to press any key (as you can do when running MATLAB code directly) to resume the program. I inserted pause("on") in the code, so the code pauses. But I cannot get it to resume. That is, even if I press any key, the code does not resume as it is supposed to.
Walter Roberson
Walter Roberson 2018년 6월 6일
Are you asking to create a "console program" or an "application" ?

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Ranjan Sonalkar
Ranjan Sonalkar 2018년 6월 6일
I don't know the difference. I use deploytool to create the deliverable APP.
  댓글 수: 3
Ranjan Sonalkar
Ranjan Sonalkar 2018년 6월 6일
I need the program to send some output to the CMD window after I start the program from the CMD window. The answer by Ben Kraus suggested to start the program from the CMD window and then use fprintf without specifying a file output. I did that but I still do not get the fprintf output text in the CMD window.
Walter Roberson
Walter Roberson 2018년 6월 6일
I do not use deploytool myself, but it appears to me that if you ask to use the application compiler, and go to the Settings icon, then there is a field for addition settings to be passed to MCC. If you put
-m
there, then I think it will create a console program. But possibly I am misreading and you might need -e instead of -m

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Environment and Settings에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by