File searching changes current folder
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I have the following program with a lot of files:
clear all
clc
close all
cd('(....here the directory...)/Desktop/Case Studies end')
addpath('(....here the directory...)/Desktop/Case Studies end/DataPlots')
%Here there are some other path files
run('NormalData/RunAllData.m');
%etc.
NormalData/RunAllData opens another files within the folder NormalData and one of them is variables.m, which, when ran, saves the workspace in a .mat file with the command
save NormalData/var.mat;
Nevertheless, it does not work when I run it in the main file which runs all data files. When I run it separately going to the file and running it, it works, but then I have to do this for all the 30 folders I have for every update I make.
The error is the following:
Error using save
Cannot create 'var.mat' because
'NormalData' does not exist.
Error in variables (line 19)
save NormalData/var.mat;
My guess is that when it runs the script NormalData/RunAllData.m, it actually changes the current folder there and therefore it does not find the directory NormalData.
0 commentaires
Réponses (1)
Voir également
Catégories
En savoir plus sur File Operations dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!