7

According to this link:

How to save contents of MATLAB's command windows to in a file?

I can back up my commends going forward using diary which is great:

However I would also like to back up my existing command history, I assume the command history is stored in a text file somewhere correct? If so can I just copy this?

Community
  • 1
  • 1
Bazman
  • 2,058
  • 9
  • 45
  • 65

2 Answers2

7

Type prefdir on Matlab and it will give you a folder.

Your command history is in that folder, in a file called history.m.

Rafael Monteiro
  • 4,509
  • 1
  • 16
  • 28
  • 1
    `prefdir` was the hint I was looking for. But the file called `History.xml` in Matlab R2014b and R2015b. A simple copy from 2014 to 2015 works fine. – mjay Sep 06 '15 at 12:24
3

Have a look at the "Save Entire Command History" submission, which will let you save all your command history, not just the last 20k allowed by MATLAB.

chappjc
  • 30,359
  • 6
  • 75
  • 132
  • Wow that might be even better! Does anyone have first hand experience of using the submission shown in the answer above? – Bazman Apr 16 '14 at 18:34
  • 1
    @Bazman I've used something like this in the past, maybe this one but i can't recall. It did as it said, but it took a little setup. – chappjc Apr 16 '14 at 18:38