Store fllepath in variable

9 vues (au cours des 30 derniers jours)
B_Richardson
B_Richardson le 2 Août 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?

Réponse acceptée

Nathan Greco
Nathan Greco le 2 Août 2011
Yes. Just store it as a string.
filepath = 'C:\Users\ecorbett\Documents\MATLAB\Labelers\fred';
filename = 'text.csv';
csvwrite(fullfile(filepath,filename),MatrixYouWantToStoreToFile);
  1 commentaire
B_Richardson
B_Richardson le 2 Août 2011
Thank you!

Connectez-vous pour commenter.

Plus de réponses (1)

Sean de Wolski
Sean de Wolski le 2 Août 2011
Sure:
fp = 'C:\Users\ecorbett\Documents\MATLAB\Labelers\fred\' %added extra \
csvwrite([fp 'my_example_csv.csv'], magic(5)) %add file name
  1 commentaire
B_Richardson
B_Richardson le 2 Août 2011
This works!

Connectez-vous pour commenter.

Catégories

En savoir plus sur Variables dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by