フィルターのクリア

How to run a script on Matlab?

92 ビュー (過去 30 日間)
Zulfiqar Khan
Zulfiqar Khan 2018 年 11 月 25 日
コメント済み: Walter Roberson 2022 年 3 月 7 日
Hi,
I can’t run the script. My friend showed me how to run the script but now I am trying alone and its not running instead it pops up profile window. Also some how I have minimized the Menu option window. I want to restore the option window. I have loaded the script and my data file is also inside the workspace.
I have searched the problem on Google but it does not show me the IDE option:
Based upon that I tried the following:
>> run (sample.m)
Undefined variable "sample" or class "sample.m".
>> run(sample);
Attempt to execute SCRIPT sample as a function:
D:\sample.m
The scripts is:
data = closeeye50;
%data = smile50;
titleplot = "closeeye50";
c = data{:,4:8};%4-8 is our actual data; 1 is counter; 2 is ...; search ied counter emotiv epoc
[n,p] = size(data);
t=1:n;
% plot(t,c);%plot of close eye
s=c(1);
fs = 128;%sampling feq from web site
N=length(s);
Some body please guide me
Zulfi.
  3 件のコメント
Luis Linares
Luis Linares 2022 年 3 月 7 日
so, where in hell is answer to his question?
Walter Roberson
Walter Roberson 2022 年 3 月 7 日
run (sample.m)
In MATLAB, that would attempt to find something named sample on the PATH, with priority given to sample.p or sample.mdl or sample.slx . Having found something named sample, it would attempt to execute it as a function returning one output. If sample turned out to refer to a script then that would result in an error.
If sample turned out to refer to something that was a function, it would execute the function and extract the first output. Then it would attempt to see if the output could be indexed with a field or property named 'm' (the .m part of the syntax.)
run(sample);
In MATLAB, that would attempt to find something named sample on the PATH, with priority given to sample.p or sample.mdl or sample.slx . Having found something named sample, it would attempt to execute it as a function returning one output. If sample turned out to refer to a script then that would result in an error.
If sample turned out to refer to something that was a function, it would execute the function and extract the first output. It would then pass that output to the run function. If the output did not happen to be a character vector or scalar string object, that would result in an error from run()
@madhan ravi and I showed the proper syntaxes below.

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

採用された回答

madhan ravi
madhan ravi 2018 年 11 月 25 日
編集済み: madhan ravi 2018 年 11 月 25 日
just type
sample %in command window and press enter
  4 件のコメント
Luis Linares
Luis Linares 2022 年 3 月 7 日
what does typing sample do?
Steven Lord
Steven Lord 2022 年 3 月 7 日
If sample is a script file or a function that has a syntax that accepts no input arguments it will execute that script or function. [I'm leaving out a bunch of the other possibilities because in the context of the original question it's most likely either a script or function call.]

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMATLAB Mobile Fundamentals についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by