How do I import my command history from a previous release, once I have installed a new one ?

댓글 수: 4

Allen
Allen 2019년 12월 18일
Roy,
Can you provide additional information regarding what steps you took to install the new version. For example:
  • Did you uninstall the older version prior to installing the new version?
  • If you still have both versions on your computer, if you open the older version, is the command history retained there?
Roy Torbert
Roy Torbert 2019년 12월 18일
I have both versions. The old version (2017b) still has command history.
Roy Torbert
Roy Torbert 2019년 12월 20일
Is there an answer to my question ?
Fangjun Jiang
Fangjun Jiang 2019년 12월 20일
I suggested below. Did you try?

댓글을 달려면 로그인하십시오.

답변 (2개)

Fangjun Jiang
Fangjun Jiang 2019년 12월 18일

1 개 추천

The command history is saved as history.xml for different versions. See if you can simply copy over the file.
C:\Users\XYZ\AppData\Roaming\MathWorks\MATLAB\R2019b\History.xml
C:\Users\XYZ\AppData\Roaming\MathWorks\MATLAB\R2018b\History.xml

댓글 수: 5

Roy Torbert
Roy Torbert 2019년 12월 20일
This applies to windows machines, and i am Mac. However, I found out how to do it and am now fine.
Fangjun Jiang
Fangjun Jiang 2019년 12월 20일
How did you do it? Please provide an answer. It might help others.
Roy Torbert
Roy Torbert 2019년 12월 20일
이동: Fangjun Jiang 2025년 1월 28일
On a Mac, I went to /Users/XYZ/Library/Pallication Support/Mathworks/Matlab/R2017a ( old version)
and copied the history.xml file to the same sort of directory but ending with R2019b ( new version).
Thanks
Walter Roberson
Walter Roberson 2025년 1월 26일
이동: Fangjun Jiang 2025년 1월 28일
Pallication Support
I think you mean Application Support
Fangjun Jiang
Fangjun Jiang 2025년 1월 27일
이동: Fangjun Jiang 2025년 1월 28일
Wow, took more than 5 years to discover a typo! What are you doing? I am curious.

댓글을 달려면 로그인하십시오.

Matt Stead
Matt Stead 2025년 1월 26일
편집: Matt Stead 2025년 1월 26일

1 개 추천

I wote this function, which works, but the history is not updated until Mtalb is relaunched. So this is part answer and part question. If anyone knows how to get Matalb to reload the history file without relaunching, I would love to know. Here is my function:
function append_history(cmd, exec_time)
% exec_time is in microseconds
% tic; <command>; exec_time = round(toc * 1e6);
hist_path = fullfile(prefdir,'History.xml');
if (exist(hist_path,'file'))
% read history file
txt = fileread(hist_path);
% condition cmd
if (isstring(cmd))
cmd = char(cmd);
end
len = length(cmd);
if (cmd(len) ~= ';')
cmd(len + 1) = ';';
end
% build xml history entry
xml_cmd = ['<command execution_time=' '"' num2str(exec_time) '">' cmd '</command>' newline];
new_txt = insertBefore(txt, '</session>', xml_cmd);
% write out file
fp = fopen(hist_path, 'w');
fwrite(fp, new_txt, 'char');
fclose(fp);
else
beep
fprintf(2, 'File not found: ''History.xml''\n');
disp('Cannot update history.');
return
end
end

카테고리

도움말 센터File Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기

제품

질문:

2019년 12월 18일

이동:

2025년 1월 28일

Community Treasure Hunt

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

Start Hunting!

Translated by