Matlab running a script I executed first no matter which script I try to run

조회 수: 11 (최근 30일)
Evan
Evan 2023년 1월 18일
댓글: Evan 2023년 1월 18일
Like the title says, I tried a code for a program and ran the program but now no matter what other script I run, it is always this one script. I have tried removing the script, deleting it but it keeps running only that one script. On top of this, none of the variables show up in the workspace. All the previous scripts are confirmed to have worked before I tried this script but I don't know what is causing it after I ran that script. This is on the online version of MATLAB which used to run all of the previous scripts.
  댓글 수: 2
Dyuman Joshi
Dyuman Joshi 2023년 1월 18일
Unless we have the code, we will not be able to (magically) tell what's wrong.
So, please attach your code.
Evan
Evan 2023년 1월 18일
This is the code that's causing the issue. This one works but any edits to the variables do not affect the output for some reason. Any other scripts that are run will just give this script's output.
A=[14.5463 14.2724 14.2043]
B=[2940.46 2945.467 2972.64]
C=[237.22 224 209]
z=[0.45 0.35 0.2]
T=80
for i=1:3
Ps(i)=exp(A(i)-B(i)/(C(i)+T))
end
Pb=sum(z.*Ps)
Pd=sum(z./Ps)
Pd=1/Pd
P=116.7
if(Pd<P)&&(P<Pb)
k=Ps./P
vo=(P-Pd)/(Pb-Pd)
for i=1:1000
fv=(sum((z.*k)./(1+ vo.*(k-1))))-1
f1v=-sum((z.*k).*(k-1))./((1+vo.*(k-1)).^2)
if (f1v~=0)
vn=vo-(fv(1)/f1v(1))
esp=abs((vn-vo)/vn)
if(esp<=0.001)
v=vn
L=1-v
y=(z.*k)./(1+vn.*(k-1))
x=y./k
sumx=sum(x)
sumy=sum(y)
pause
else
vo=vn
end
else
fprintf('error')
end
end
else
fprintf('not possible')
end

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

답변 (1개)

Star Strider
Star Strider 2023년 1월 18일
Check to see if you have a copy of it somewhere. MATLAB may be running the copy and ignoring the version you want to run, or it may be running the version you want to run first, and then the other version, so the output never changes.
Also, be sure the version you want to run is saved in the MATLAB search path (What Is the MATLAB Search Path?).
  댓글 수: 2
dpb
dpb 2023년 1월 18일
To see what MATLAB thinks are available versions of the specific function/script, type
which -all yourscriptOrfunctionname
Use the script name in place of the above placeholder, of course.
Also, another possibility is you've inadvertently saved the m-file of your script that you're making edits in with the wrong filename -- a misspelling or capitalization difference, MATLAB function and variable names are case sensitive even though on Windoes file names are case-preserving but not case sensitive.

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

카테고리

Help CenterFile Exchange에서 Creating, Deleting, and Querying Graphics Objects에 대해 자세히 알아보기

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by