Running a downloaded code by clicking on the Run button

조회 수: 1 (최근 30일)
tr206
tr206 2015년 3월 21일
편집: Star Strider 2015년 3월 21일
When I download the code, the code opens in the Editor. How can I run the code in the command window? Can I run the code by clicking on the Run button?
  댓글 수: 1
tr206
tr206 2015년 3월 21일
Thanks for your help it seems to work. I have a problem with importing the data. I use Matlab R 2013a and want to import daily stock returns by using the xlsread command. It works but I do not get the data I want. Instead of getting the returns and the corresponding date I get an output which looks as follows: 0.0002 0.0000 0.0000 1.9861 0.0000 0.0002 0.0000 0.0000 1.9861 -0.0000 0.0002 0.0000 0.0000 1.9861 -0.0000 0.0002 0.0000 0.0000 1.9861 -0.0000 0.0002 0.0000 0.0000 1.9861 -0.0000 0.0002 0.0000 0.0000 1.9861 -0.0000 I want the format as shown in the attached Excel-file. How can I create a Matlab data file? I want to use the command load to the data. It would be great if I could create a matlab data file and import the date using the command "load" since I could run the code without changing it.

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

답변 (3개)

Star Strider
Star Strider 2015년 3월 21일
편집: Star Strider 2015년 3월 21일
Run the code from the Command Window by typing its file name at the prompt (the ‘.m’ extension is not necessary), and hitting ‘enter’.
----------
EDIT There was no attached Excel file. However, if you want to import Excel files into MATLAB, use the xlsread function, preferably with 3 outputs.

Image Analyst
Image Analyst 2015년 3월 21일
There are at least 3 ways:
  1. You can click on the green Run triangle on the tool ribbon,
  2. or (if your cursor is in the editor window) you can type the F5 key.
  3. Or you can type the name of the m-file on the command line.

Stephen23
Stephen23 2015년 3월 21일
편집: Stephen23 2015년 3월 21일
Try the very useful f9 key: pressing the f9 button will run any function or script that is currently highlighted/selected in the current folder panel in MATLAB. You can also use to to run any highlighted piece of code from any script, function, or the command window.

카테고리

Help CenterFile Exchange에서 Spreadsheets에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by