MATLAB Answers

Store fllepath in variable

1 view (last 30 days)
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?

Accepted Answer

Nathan Greco
Nathan Greco on 2 Aug 2011
Yes. Just store it as a string.
filepath = 'C:\Users\ecorbett\Documents\MATLAB\Labelers\fred';
filename = 'text.csv';

More Answers (1)

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


Community Treasure Hunt

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

Start Hunting!