How to save 'multiple functions' in new folder?
    2 views (last 30 days)
  
       Show older comments
    
    Ivan Shorokhov
      
 on 4 Jul 2016
  
    
    
    
    
    Commented: Star Strider
      
      
 on 6 Jul 2016
            Hello,
I have used the following code to Identify Program Dependencies:
[fList,pList] = matlab.codetools.requiredFilesAndProducts('myFun.m');
Next I would like to save the output functions from fList into new folder.
I have tried the following code:
[fList,pList] = matlab.codetools.requiredFilesAndProducts('myFun.m');
fList = fList';
for n = 1:length(fList)
    save(fList{n,1});
    % copyfile('fList{n,1}','C:\Users\...\New_folder');
end
But it didn't work.
2 Comments
  John D'Errico
      
      
 on 4 Jul 2016
				Copying m-files around programmatically, so that you end up with multiple copies is asking for buggy code, that will be impossible to manage. Good luck, but expect it to create pure hell for you.
Accepted Answer
  Star Strider
      
      
 on 4 Jul 2016
        I would save the entire cell array as one variable, to a single .mat file.
Example:
save('MyFun_Dependendency_Files.mat', 'fList');
or something similar. The loop is not necessary, and will likely caus problems for you.
8 Comments
More Answers (0)
See Also
Categories
				Find more on File Operations in Help Center and File Exchange
			
	Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


