Save a file to the first folder in mathpath (the MATLAB-folder)
조회 수: 13 (최근 30일)
이전 댓글 표시
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
채택된 답변
KSSV
2016년 6월 16일
If your interest is to call the saved matfile without mentioning it's path: you have to create a folder and save every file you want in that..and set the path to this folder. You can use this file without mentioning its path. doc 'pathtool'
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 File Operations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!