Save a file to the first folder in mathpath (the MATLAB-folder)
显示 更早的评论
I want to save a variabel to a file and now I use the command: "save filename.mat variabel", but my problem is that I want to save this mat-file in the MATLAB-folder cause if I do so MATLAB can find it directly when you use: "load filename". I know, I can use cd(path) there "path" is the adress to the specific folder I want to save it in, but I want this to work not only for my computer and the adress to this MATLAB-folder is different on different computers and I don't want to change anything when I switch computer. The MATLAB-folder I want to save the file to I think it's always number one in "matlabpath" - the list of the folders that MATLAB is searching for files in. Can I use this information somehow? I want to get the first folder in this list and write cd(number1inthelist). I tried to write mathpath(1) but it didn't work.
Is it someone out there that can help me?
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 File Operations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!