Different computer save folder
Mostrar comentarios más antiguos
I have a script that I need to share with my professor. I used the commands uigetfile and uigetdir so that my professor can select my sent files for analysing but I was wondering if there was an easier way that my professor could use the scripts and if there is a way that he can write everything to a folder? I have already seen something like this : [pathname ] but I can not figure it out. Please help
6 comentarios
OCDER
el 13 de Oct. de 2017
There may be a solution depending on what your requirements are:
- Can you list in order the current steps taken by your professor? Ex: 1) download script, 2) copy file, 3) open matlab, 4) find + run script, 5) select file, 6) save file, 7) move file....
- What file is this script accessing? (Or show us the script)
- What is the script generating?
- Do you want the script to access many different files with different names and different folder locations? uigetfile is pretty convenient, and you can set the default dir it opens to.
- Do you have a shared folder setup on a network that's always there?
- What is "everything" that needs to be written to a folder?
Debbie Oomen
el 13 de Oct. de 2017
OCDER
el 13 de Oct. de 2017
Is the script located in HIS computer in the right folder? If so, the following can be used to determine the directory of the script:
TargetDir = fileparts(mfilename('fullpath'))
Also, how do you want to save T, f, N? as a txt, mat, csv, xlsx? What about t, y1, which are different sizes than f, fs, T, etc.?
Debbie Oomen
el 13 de Oct. de 2017
I see, so you want to save the output folder to the parent directory of the script? EX:
Professor computer has:
C:/ThisDir/Script
C:/ThisDir/EMG
You want script to automatically find the EMG files, and then save results to:
C:/ThisDir/output.xlsx ? or
C:/ThisDir/Ouput/output.xlsx ?
Also, I'm assuming output.xlsx is saving T, f, fs, etc for every .emg file (so 100 emg files will give you 100 data rows) ?
Debbie Oomen
el 13 de Oct. de 2017
Respuesta aceptada
Más respuestas (1)
A simple way to do this is to use mfilename to find the path to where the file is being run on the professor's computer.
[folderPath,fileName] = fileparts(mfilename('fullpath'));
OutputPath = fullfile(folderPath,'OutputDirectory');
if ~exist(OutputPath,'dir')
mkdir(OutputPath)
end
outputFile1 = fopen(fullfile(OutputPath,'OutputFile1.txt'),'w');
fclose(outputFile1);
1 comentario
Debbie Oomen
el 1 de Nov. de 2017
Categorías
Más información sobre Text Data Preparation en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!