Save error on linux

3 ビュー (過去 30 日間)
Amirhossein Moosavi
Amirhossein Moosavi 2021 年 4 月 22 日
コメント済み: Jan 2021 年 4 月 22 日
Hello,
I have program that I run it through a script. At the same time, the script uses many functions to compute required components. When I run this program on my laptop (Windows 10), there is no problem and everthing works pretty well. But when I try to run this program on Compute Canada (it is a central and slurm-based computer that uses Linux), the program works pretty great except the last line, where I want to save the outcome. Note that I am using Matlab2020a on Compute Canada. I receive an error like below:
{Error using save
Can not write file /project/XXX/XXX/LTC/ACO/Realistic_ins/ACO_1_1.mat.
Error in aco_1 (line 366)
save(saveName, 'ARCH', 'CPUT');
Error in run (line 91)
evalin('caller', strcat(script, ';'));
}
What would be the reason of this problem?
Best, Amir.

回答 (1 件)

Jan
Jan 2021 年 4 月 22 日
編集済み: Jan 2021 年 4 月 22 日
Does the folder "/project/XXX/XXX/LTC/ACO/Realistic_ins/" exist? Mounting a folder "/project" directly as root folder is very unusual. Is this path relative to your own user folder? Then this would be:
'~/project/XXX/XXX/LTC/ACO/Realistic_ins/'
  2 件のコメント
Amirhossein Moosavi
Amirhossein Moosavi 2021 年 4 月 22 日
編集済み: Amirhossein Moosavi 2021 年 4 月 22 日
Thanks! The folder exists, my script and all relevant functions are in the same folder, and the folder is related to my user. This is so strage for me since the program successfully finishes some test instances, but unsuccessfully some others (all of them work with no problem on my own laptop). I am currently using the below code to save the outcome:
saveName = append('ACO_', fName, '.mat');
save(saveName, 'ARCH', 'CPUT');
According to your suggestion, I should change it as bellow. Am I right? Does it make any diiference since all codes are in that folder?
saveName = append('~/project/XXX/XXX/LTC/ACO/Realistic_ins/ACO_', fName, '.mat');
save(saveName, 'ARCH', 'CPUT');
Jan
Jan 2021 年 4 月 22 日
Under Linux "/project" is a root folder. If you mean "relative to the current folder, use "./project". It the folder is relative to the user folder "~/project".
The location of the M-files does not matter, because this is not necessarily the current folder. The best idea to avoid such errors is not to use relative folders, but absolute ones.

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

カテゴリ

Help Center および File ExchangeCluster Configuration についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by