This is a script that analysis various data parameter and it saves them by each test that was ran.
After each experiment there will always be the following matrix's and figure that need to get exported to the rest of the group. Is there a way to avoid renaming each file individually? Perhaps the accompanying code will help explain my problem. Any help would be appreciated.
Current matrix's created after analysis: ALL_PPI ALLG_Means_tr DPPI SPSS_PPI_Means SPSS_PPI print('SHK3_ASD_W3_PPI','-dpng','-r300');
Current Code:
cd ('/Users/aamaya/Documents/MATLAB/PPI_All/Data_Analysis');
print('SHK3_ASD_W3_PPI','-dpng','-r300');
csvwrite('SHK3_ASD_W3_PPI.csv',ALL_PPI)
csvwrite('SHK3_ASD_W3_Means.csv',ALLG_Means_tr)
csvwrite('SHK3_ASD_W3_DeltaPPI.csv',DPPI)
csvwrite('SHK3_ASD_W3_MSPSS.csv',SPSS_PPI_Means)
csvwrite('SHK3_ASD_W3_PSPSS.csv',SPSS_PPI)
cd ('/Users/aamaya/Documents/MATLAB');
Desired Code:
Experiment_Name=['SHK3_ASD_W3_PPI']
cd ('/Users/aamaya/Documents/MATLAB/PPI_All/Data_Analysis');
print('Experiment_Name','-dpng','-r300');
csvwrite('Experiment_Name.PPI.csv',ALL_PPI)
csvwrite('Experiment_Name.Means.csv',ALLG_Means_tr)
csvwrite('Experiment_Name.DeltaPPI.csv',DPPI)
csvwrite('Experiment_Name.MSPSS.csv',SPSS_PPI_Means)
csvwrite('Experiment_Name.PSPSS.csv',SPSS_PPI)
cd ('/Users/aamaya/Documents/MATLAB');

 Respuesta aceptada

dpb
dpb el 1 de Jul. de 2014

0 votos

This specifically addresses creating input file names, but the idea is the same for output files as well--pick some naming algorithm and go for it...it can be sequential numbers as demonstrated there, but there's nothing that says it must be. Use whatever scheme makes sense for your situation, just as long as you have a rule to create the name.

1 comentario

Aldo Amaya
Aldo Amaya el 2 de Jul. de 2014
Thanks for the suggestion, it led me to ask the right questions. But this following article did exactly what I was looking for
In addition, I will add the code for those who might be looking later on. The new code.
Experiment_Name=['Aldo']
cd ('/Users/aamaya/Documents/MATLAB/PPI_All/Data_Analysis');
print([sprintf('%s_PPI',Experiment_Name')],'-dpng','-r300');
csvwrite([sprintf('%s_PPI',Experiment_Name),'.csv'],ALL_PPI)
csvwrite([sprintf('%s_Means',Experiment_Name),'.csv'],ALLG_Means_tr)
csvwrite([sprintf('%s_DeltaPPI',Experiment_Name),'.csv'],DPPI)
csvwrite([sprintf('%s_MSPSS',Experiment_Name),'.csv'],SPSS_PPI_Means)
csvwrite([sprintf('%s_PSPSS',Experiment_Name),'.csv'],SPSS_PPI)
cd ('/Users/aamaya/Documents/MATLAB');

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Etiquetas

Preguntada:

el 1 de Jul. de 2014

Comentada:

el 2 de Jul. de 2014

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by