I have a command in the command line of Matlab which is longer than just one line but when recalling it by pressing arrow-up, I just can go through every single line of the multiline-code... Is ther开发者_运维知识库e a way to recall the complete last execution, no matter if just single or multiline?! thanks!
In the Command History window, highlight the relevant lines and press F9 (or right-click and select Evaluate Selection if your shortcuts differ from mine).
The simplest solution is to right click the particular line in the command history window and select Copy
or Evaluate Selection
:)
If you'd like to copy a significant portion of your history, then you can output the contents of your history file (which is stored in history.m
in the preferences directory) to the command window and copy from there.
type([prefdir '/history.m'])
%-- 20/6/11 3:17 PM --%
clc
outputVariable=someVeryLongFunctionNameThatMakesNoSense(inputVar1,'inputString1',inputVar2)
type([prefdir '/history.m'])
The above command and the screenshot were on a Mac. As always, be careful with the /
on Windows. I can never remember which way it leans...
精彩评论