Reputation: 10176
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 there a way to recall the complete last execution, no matter if just single or multiline?! thanks!
Upvotes: 5
Views: 1369
Reputation: 42225
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...
Upvotes: 2
Reputation: 48398
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).
Upvotes: 3