MATLAB code not running

조회 수: 8 (최근 30일)
Benino
Benino 2025년 2월 23일
댓글: Benino 2025년 2월 23일
I am trying to run a very simple MATLAB script
A=[12,-3;-3,4]
A = 2×2
12 -3 -3 4
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
C=[-9;9]
C = 2×1
-9 9
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
sol = inv(A)*C
sol = 2×1
-0.2308 2.0769
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
When I click the run button, it doesn't do anything. When I press ctrl+enter, the run button changes into a pause button, but nothing shows up in the command window. My workspace shows I created a variable "i" with a value of 25 and a 1x100 double "x", but I never did, and it won't let me clear them. It also will not let me create a new script. How do I fix this?

채택된 답변

Walter Roberson
Walter Roberson 2025년 2월 23일
The most likely cause would be if you had a third-party function named inv
Check with
which -all inv
built-in (/MATLAB/toolbox/matlab/matfun/inv) built-in (/MATLAB/toolbox/matlab/matfun/@double/inv) % double method built-in (/MATLAB/toolbox/matlab/matfun/@single/inv) % single method inv is a built-in method % matlab.unittest.internal.fixtures.FolderScope method inv is a built-in method % matlab.automation.Verbosity method built-in % gpuArray method /MATLAB/toolbox/control/ctrlmodels/@InputOutputModel/inv.m % InputOutputModel method /MATLAB/toolbox/parallel/array/distributed/@codistributed/inv.m % codistributed method /MATLAB/toolbox/parallel/gpu/gpu/@gpuArray/inv.m % gpuArray method /MATLAB/toolbox/symbolic/symbolic/@sym/inv.m % sym method
Experiment with using
restoredefaultpath; rehash toolboxcache
and trying again. If it does not start working, look more carefully for an inv.m function in your current directory.
  댓글 수: 1
Benino
Benino 2025년 2월 23일
okay, thanks. there was an infinite loop running. I don't know where it came from, but it's fixed now.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

제품


릴리스

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by