Programmatically Change Preferences?

28 ビュー (過去 30 日間)
meghannmarie
meghannmarie 2020 年 9 月 15 日
編集済み: Stefanie Schwarz 2023 年 3 月 28 日
How do I promatically change preferences? I am running a script from command line in linux (on a HPC). I am using a tall array and I am getting this error: "Error using matlab.mapreduce.internal.Serializer/writeToMatfile (line 44). Unable to write to MAT-file because one of the values exceeds the size limit. Ensure each value is less than 2GB or use a Hadoop location." I think I may have to set my preferences to save matfiles as version 7.3. How do I do that in a script?
I tried this on my windows machine and it does not seem to work.
pref = regexp( fileread(fullfile(prefdir,'matlab.prf')), '\n', 'split');
loc = find(~cellfun(@isempty,regexp(pref,'MatfileSaveFormat=')));
if isempty(loc); pref{end+1} = 'MatfileSaveFormat=Sv7.3';
else; pref{loc} = 'MatfileSaveFormat=Sv7.3';
end
fid = fopen(fullfile(prefdir,'matlab.prf'), 'w');
fprintf(fid, '%s\n', pref{:});
fclose(fid);
Any ideas?

採用された回答

Fangjun Jiang
Fangjun Jiang 2020 年 9 月 15 日
編集済み: Stefanie Schwarz 2023 年 3 月 28 日
to save matfiles as version 7.3, use save(FILENAME, ..., VERSION)
  2 件のコメント
meghannmarie
meghannmarie 2020 年 9 月 15 日
I am not saving any files, so I cannot use save(FILENAME, ..., VERSION). The tall array function is saving a matfile in a temporary folder.
meghannmarie
meghannmarie 2020 年 9 月 15 日
I think this may work, trying it now:
s = settings;
s.matlab.general.matfile.SaveFormat.TemporaryValue = 'v7.3';

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeWorkspace Variables and MAT-Files についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by