Function run(scriptname) doesn't work.

50 ビュー (過去 30 日間)
LUONG Vuong-son
LUONG Vuong-son 2019 年 11 月 19 日
コメント済み: Adam Danz 2019 年 11 月 21 日
when i try to execute my script from command:
run('C:\Users\hello.m')
==> nothing happens (no error).
my script 'hello.m' is not executed. however, if i use matlab editor to run this script. It works.
Somebody can tell me why and help me figure out the solution, please!
when i use the commande "echo on all" to check.
normally it displays:
% Finally, evaluate the script if it exists and isn't a shadowed script.
evalin('caller', [script ';']);
***************************** hello ***********************
**************************** i am son*******
*********************************************************
*********************************************************
*****************************---------------*******************************
*********************************
*********************************
*********************************
delete(cleaner);
however, on my PC it displays:
% Finally, evaluate the script if it exists and isn't a shadowed script.
evalin('caller', [script ';']);
delete(cleaner);
  8 件のコメント
LUONG Vuong-son
LUONG Vuong-son 2019 年 11 月 21 日
i have just add the command into script ('run.m') to check the log message.
% Finally, evaluate the script if it exists and isn't a shadowed script.
%disp(script);
evalin('caller', [script ';']);
delete(cleaner);
and now, it works. Really, i don't know why?
Adam Danz
Adam Danz 2019 年 11 月 21 日
It was probably always working. For example, run this script and you'll see no evidence that it was executed.
t = 0;
x = t+9;

サインインしてコメントする。

回答 (1 件)

Jan
Jan 2019 年 11 月 21 日
Store the M-files in a folder, in which you have full access. C:\Users\ is a bad idea. Create a folder somewhere else, e.g. inside your user folder, in the documents, on disk D, etc.
"Run function is always stubbed!" Is it? Then perhaps you have overwritten it? Check it:
which run -all
Check your script also:
which hello -all
type('C:\Users\hello.m') % Again: choose another folder
As said already, set a breakpoint in the code to check, if Matlab processes the assumed file at all.

カテゴリ

Help Center および File ExchangeDebugging and Analysis についてさらに検索

タグ

製品


リリース

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by