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

14 Ansichten (letzte 30 Tage)
Evan
Evan am 18 Jan. 2023
Kommentiert: Evan am 18 Jan. 2023
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 Kommentare
Dyuman Joshi
Dyuman Joshi am 18 Jan. 2023
Unless we have the code, we will not be able to (magically) tell what's wrong.
So, please attach your code.
Evan
Evan am 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

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Star Strider
Star Strider am 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 Kommentare
dpb
dpb am 18 Jan. 2023
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.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Get Started with MATLAB finden Sie in Help Center und File Exchange

Produkte


Version

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by