Unable to resolve the name 'out.EM_n'

조회 수: 8 (최근 30일)
DAVIDE PARMIGGIANI
DAVIDE PARMIGGIANI 2024년 6월 3일
답변: Ayush Singh 2024년 6월 11일
Hi, I've a MATLAB/Simulink program that is launched by the GUI. Actually, I can't plot some parameters through the Stopfcn, because if i launch the program with GUI they're not saved in the workspace, so I'm forced to run the simulation by Simulink.
---- Error evaluating 'StopFcn' callback of block_diagram '****'
scatter(out.EM_n,out.EM_T,'filled','.','markeredgecolor',[1 0 0])
Unable to resolve the name 'out.EM_n' ----
'Save data to workspace or file' is set to 'Single simulation output'

답변 (1개)

Ayush Singh
Ayush Singh 2024년 6월 11일
Hi Davide,
By default 'Save data to workspace or file' is set to 'Single simulation output', so Simulink saves all the simulation outputs in a single 'Simulink.SimulationOutput' object. To access the data, you need to refer to the specific signals you're interested in by their names as fields of this object.
Below are possible steps you can try out to resolve the issue:
  1. First, ensure that the signals EM_n and EM_T are being logged. You can log signals by right-clicking on a signal in your Simulink model and selecting 'Log Selected Signals'. This action marks the signal for logging, and its data will be available in the simulation output.
  2. Assuming 'out' is the variable you have your simulation output saved to, you access logged signals like this:
EM_n_data = out.logsout.get('EM_n').Values;
EM_T_data = out.logsout.get('EM_T').Values;
3. Now you can use the 'scatter' function like below:
scatter(EM_n_data,EM_T_data,'filled','.','markeredgecolor',[1 0 0])
Hope it helps!

카테고리

Help CenterFile Exchange에서 Scopes and Data Logging에 대해 자세히 알아보기

제품


릴리스

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by