-logfile option changes output
이전 댓글 표시
I am working on an Azure Pipeline. I need to echo the script output to the pipeline, and check the output to see if the stage failed. My current PowerShell code looks like this.
$cur_dir = $Env:AGENT_BUILDDIRECTORY
$log_file = Join-Path $cur_dir '\log_file.txt'
$cmd = Join-Path $cur_dir '\base\modeling_tools\matlab\stupid_permissions_workaround.m'
Write-Host $cmd
$args = "-logfile $log_file -nodisplay -nosplash -r run('$cmd'); exit();"
Start-Process matlab -ArgumentList $args -Wait
Get-Content $log_file | Write-Host
if ($log_file -match 'TOTAL NUMBER OF FAILED BLOCKS:: 0'){
$rv = 0
}
The output saved in log_file.txt does not match the output when I run the script in Matlab. The output captured in log_file.txt is getting truncated, and I have no idea why. Is there a better way to capture the output than using the -logfile option?
Output when run inside MATLAB Output in log_file.txt
'TOTAL NUMBER OF FAILED BLOCKS:: 38' 'TOTAL NUMBER OF FAILED BLOCKS:: 38'
{'Check Name' } {'Time' } {'Check Name' } {'Time' }
{["STD-MBD-098 Top Level Model" ]} {[1.1502]} {["STD-MBD-098 Top Level Model" ]} {[2.1924]}
{'STD-MBD-122 Sample Time' } {[0.1825]} {'STD-MBD-122 Sample Time' } {[0.3057]}
{'STD-MBD-065 Relational Blocks' } {[2.0332]} {'STD-MBD-065 Relational Blocks' } {[3.6043]}
{'STD-MBD-163 Nested States Standard' } {[0.0032]} {'STD-MBD-163 Nested States Stand…'} {[0.0089]}
{'STD-MBD-108 States Entry: During: Exit:' } {[0.0198]} {'STD-MBD-108 States Entry: Durin…'} {[0.0413]}
{'STD-MBD-097 Foreground color' } {[0.1659]} {'STD-MBD-097 Foreground color' } {[0.3120]}
{'STD-MBD-092 Outport Color' } {[0.0805]} {'STD-MBD-092 Outport Color' } {[0.2048]}
{["STD-MBD-100 Name Display" ]} {[0.0272]} {["STD-MBD-100 Name Display" ]} {[0.0575]}
{'STD-MBD-164 MATLAB Functions Prohibited' } {[0.0162]} {'STD-MBD-164 MATLAB Functions Pr…'} {[0.0283]}
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Entering Commands에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!