フィルターのクリア

Unable to resolve the name 'out.EM_n'

5 ビュー (過去 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 Center および File ExchangeScopes 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