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

2 views (last 30 days)
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 Comments
Evan
Evan on 18 Jan 2023
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

Sign in to comment.

Answers (1)

Star Strider
Star Strider on 18 Jan 2023
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 Comments

Sign in to comment.

Categories

Find more on Entering Commands in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by