It is a function (not an script) and it needs some input arguments to run (in this case A
and x
), so you cannot hit the run button and expect it to run.
The first way:
Instead you can use the command windows in MATLAB and enter the command:
A = rand(3,3); % define A here
x = ones(3,1); % define x here
test(A,x) % then run the function with its arguments
remember that A
and x
should be defined properly.
The second way is:
Also you can hit the little triangle besides the green run button (see the figure below), and it will show you another option, type command to run
. And
there you can directly enter the same command test(A,x)
. After that, each time you just hit enter for this function and it runs this command instead of only the test
command without any argument.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…