How do I get print statements to show up in Console Window of deployed *.exe App?

조회 수: 4 (최근 30일)
Folks,
I am trying to debug a problem that only occurs in a deployed version of a Matlab GUI. The console window that is running when the *.exe GUI is executed will not show my executions like this:
a = 3
sprintf('hi jack = %d', a)
However, it will show
'This is a test'
This of course makes debugging problems in a deployed *.exe challenging. Can anyone offer workarounds or knowledge about best practices for debugging deployed apps?
Here is specific code:
function [o, oc] = GetASPMPOutputClone(tc, pc)
'sleeping 1 sec'
pause(1)
o = calllib('ASPMP64', 'AllocateOutputASPMP', tc, pc);
oc = get(o, 'value');
'sleeping 1 sec: b'
pause(1)
nRange = tc.nRange;
nTime = tc.nTime;
setdatatype(oc.slowSemb, 'doublePtr', oc.nSlowSemb, 1);
setdatatype(oc.timeSemb, 'doublePtr', oc.nTimeSemb, 1);
setdatatype(oc.rawCoherenceMap2D, 'doublePtr', 4*oc.nSlowSemb*oc.nTimeSemb, 1);
setdatatype(oc.finCoherenceMap2D, 'doublePtr', 4*oc.nSlowSemb*oc.nTimeSemb, 1);
setdatatype(oc.finBeamMap2D, 'doublePtr', 4*oc.nSlowSemb*oc.nTimeSemb, 1);
setdatatype(oc.finSNRMap2D, 'doublePtr', 4*oc.nSlowSemb*oc.nTimeSemb, 1);
setdatatype(oc.waves, 'doublePtr', nRange*nTime, 1);
sprintf('nRange, nTime = %d %d', nRange, nTime);
'sleeping 1 sec: c'
pause(1)
setdatatype(oc.wavesInstAmp, 'doublePtr', nRange*nTime, 1);
setdatatype(oc.wavesInstFreq, 'doublePtr', nRange*nTime, 1);
setdatatype(oc.wavesMaxCoh, 'doublePtr', nRange*nTime, 1);
setdatatype(oc.wavesOptSlow, 'doublePtr', nRange*nTime, 1);
setdatatype(oc.wave, 'doublePtr', nTime, 1);
setdatatype(oc.waveEnv, 'doublePtr', nTime, 1);
setdatatype(oc.detector, 'doublePtr', nTime, 1);
setdatatype(oc.shortTermAve, 'doublePtr', nTime, 1);
setdatatype(oc.longTermAve, 'doublePtr', nTime, 1);
setdatatype(oc.timeWinBeg, 'doublePtr', 4, 1);
setdatatype(oc.timeWinEnd, 'doublePtr', 4, 1);
setdatatype(oc.slowWinBeg, 'doublePtr', 4, 1);
setdatatype(oc.slowWinEnd, 'doublePtr', 4, 1);
setdatatype(oc.timePicksObserved, 'doublePtr', nRange, 1);
setdatatype(oc.timePicksQuality, 'doublePtr', nRange, 1);
setdatatype(oc.timePicksEstimated, 'doublePtr', nRange, 1);
'sleeping 1 sec: d'
pause(1)
setdatatype(oc.variableDensityLayerRaw1D, 'doublePtr', 4*oc.nSlowSemb, 1);
setdatatype(oc.variableDensityLayerFin1D, 'doublePtr', 4*oc.nSlowSemb, 1);
setdatatype(oc.variableDensityLayerRaw1DUpSampled, 'doublePtr', 4*oc.nSlowSembUpSampled, 1);
setdatatype(oc.variableDensityLayerFin1DUpSampled, 'doublePtr', 4*oc.nSlowSembUpSampled, 1);
sprintf('nSlowSemb = %d', oc.nSlowSemb);
sprintf('nSlowSembUpSampled = %d', oc.nSlowSembUpSampled);
'sleeping 1 sec: d2'
pause(1)
setdatatype(oc.slowPicks,'doublePtr', 2, 1);
setdatatype(oc.slowPosErrorPicks,'doublePtr', 2, 1);
setdatatype(oc.slowNegErrorPicks,'doublePtr', 2, 1);
None of the sprintf statements get displayed. Nor will any "a = 1" statements if I put them in. The whole app catches a throw when it gets to the "setdatatype(oc.slowPicks" line, reporting:
Undefined function 'setdatatype' for input arguments of type 'double'.
This post is not about this particular error, but about how to debug in the *.exe environment.
Thank you, Kristoffer Walker

채택된 답변

Kristoffer Walker
Kristoffer Walker 2018년 1월 26일
I have found an answer that helps from another post. Execute the *.exe from within the Matlab GUI window. This enables some of the previously hidden print statements to be displayed in the Matlab GUI console window.
Kris

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Testing Frameworks에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by