Store fllepath in variable

2 visualizaciones (últimos 30 días)
B_Richardson
B_Richardson el 2 de Ag. de 2011
Hello all! Quick question:
is it possible to store a fullpath: C:\Users\ecorbett\Documents\MATLAB\Labelers\fred into a variable and use that variable in functions like csvwrite?

Respuesta aceptada

Nathan Greco
Nathan Greco el 2 de Ag. de 2011
Yes. Just store it as a string.
filepath = 'C:\Users\ecorbett\Documents\MATLAB\Labelers\fred';
filename = 'text.csv';
csvwrite(fullfile(filepath,filename),MatrixYouWantToStoreToFile);

Más respuestas (1)

Sean de Wolski
Sean de Wolski el 2 de Ag. de 2011
Sure:
fp = 'C:\Users\ecorbett\Documents\MATLAB\Labelers\fred\' %added extra \
csvwrite([fp 'my_example_csv.csv'], magic(5)) %add file name

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by