Ctrl+Enter versus. Clicking Run

31 次查看(过去 30 天)
What is the difference between executing a code with the use of crtl+enter versus clicking run at the top of the toolbar?
[EDITED, Jan, copied from answer section]
Sorry that I wasn't clear.
Sometimes when I use crtl+enter, I receive errors that I would not if I clicked on run. These errors are specific to the code. In one of my codes, I constantly received the error "function is not defined" or something along those lines, but the function WAS defined. I had no problem running this code by clicking run.
  1 个评论
Jan
Jan 2013-10-6
编辑:Jan 2013-10-6
Please add important information inside the original question, where readers find them immediately. The section for answers should be reserved for solutions or suggestions. Thanks.
Do the "function not defined" messages concern subfunctions in the currently opened M-file or in its folder? While "Run" or F5 runs the file in its folder, other M-files are found there even if the folder is not part of the Matlab's path.

请先登录,再进行评论。

回答(2 个)

Subin Kuttappan Stellal Mary
编辑:Subin Kuttappan Stellal Mary 2015-12-9
Ctrl+Enter execute a block of code (between two lines starting with %%)
Run or 'F5' executes the entire file.

Jan
Jan 2013-10-6
I do not know corresponding points in the documentation, but only tried a little bit in the editor:
  1. "Run" or F5 requires the file to be saved
  2. F5 allows to define input arguments
  3. Ctrl-Enter runs the code without saving also.
Do you observe other differences? Perhaps a more useful answer can be given if you explain the problem you have.

类别

Help CenterFile Exchange 中查找有关 Workspace Variables and MAT-Files 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by