MATLAB: A=’C:\code’. cd ‘C:\code’ works fine but cd a gives error: Name is nonexistent or not a directory change directory How can I pass a "a" as address to change directory not the whole address? Best Answer The following two cd calls do the same thing, changing directory to a directory named a.cd acd('a')The following two cd calls do the same thing, changing directory to the directory c:\code.a = 'c:\code';cd(a)cd c:\codeThe first set of cd calls does not do the same thing as the second set of cd calls.See this documentation page for a description of how to use either the command syntax or the function syntax to call a function. Related SolutionsMATLAB: How to make a new folder within another folder Just use one argument: mkdir(newsubfolder);And in the for fileidx = 1 : length(fileinfo) loop, get rid of the linesnewsubfolder = fullfile(newdir, subfolderi);mkdir(newsubfolder)This has to be done just once for each subfolder, not once for each file in a subfolder. MATLAB: Problem when using cd command cd(CurrPath) Related QuestionIs it possible to use “userpath” as a normal variable in MATLAB 7.6 (R2008a)How to read all text files in a folder without making a structFiles not being read correctlyMissing Statistics Toolbox
Best Answer