- 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.
- Assuming 'out' is the variable you have your simulation output saved to, you access logged signals like this:
Unable to resolve the name 'out.EM_n'
10 views (last 30 days)
Show older comments
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'
0 Comments
Answers (1)
Ayush Singh
on 11 Jun 2024
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:
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!
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!