How do I run a script for simulink?

조회 수: 2 (최근 30일)
Maty Blanc
Maty Blanc 2016년 4월 8일
댓글: Maty Blanc 2016년 4월 8일
Hello, I am trying to run a simulation on simulink (I am brand new to simulink), but I am not able to. I keep getting an error saying C:~~ is a shadow of another file, to delete it and try again.
In Matlab I created a script that has all of the variables needed for the simulink, I ran this and my workspace then showed all of of those variables, I was able to create a simulink file and run it (referencing the Matlab workspace variables). However after I close the simulink and Matlab, if I want to go back to running the simulink, or even altering a variable, I can't re-run the script. It says that the *.slx file shadows it. So then I can't even run the simulink file because the variables aren't in the workspace, because I can't run the script. This is my entire script,
Fsamp = 12e3;
T = 1/Fsamp;
NB = 4;
VREF = 5;
delta = (2^(1-NB))*VREF;
l1 = VREF - delta;
l2 = -VREF;
f1 = 7;
amp = VREF - delta;
There are just variables I used for simulink. I've seen solutions about the function 'sim', however I don't want to run simulink through the script, I would like to update the variables by just running the script. I can do this through the command in Matlab, but I'd like to add functions, or different variables on the go, I don't want to be limited by the command window.
Is this possible? How do I run this script to add the variables to the workspace for simulink? If this isn't possible, what can I do?
  댓글 수: 2
Fangjun Jiang
Fangjun Jiang 2016년 4월 8일
Did you name the MATLAB script and Simulink model the same? For example test.m test.slx
Maty Blanc
Maty Blanc 2016년 4월 8일
Yes I did, they're Q4.m and Q4.slx.

댓글을 달려면 로그인하십시오.

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2016년 4월 8일
Probably you gave the same name to your slx model and your m-file. Rename one of the two files
  댓글 수: 1
Maty Blanc
Maty Blanc 2016년 4월 8일
Wow, I did not it was this simple... I looked everywhere, only could find stuff about the function 'sim', thank you very much.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Simulink Environment Customization에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by