Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Recall Matlab History with Multiline-Command

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!

like image 617
tim Avatar asked Jun 20 '11 22:06

tim


2 Answers

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).

like image 78
PengOne Avatar answered Sep 26 '22 04:09

PengOne


The simplest solution is to right click the particular line in the command history window and select Copy or Evaluate Selection :)

enter image description here

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...

like image 33
abcd Avatar answered Sep 22 '22 04:09

abcd