Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Writing table to specific folder

I am wondering how one can save a table using the following

 filename_excel = [ name '_N' num2str(1) '.xlsx'];
 writetable(Table,filename_excel,'Sheet', 3, 'Range','A5');

to a specific directory/folder other than the current folder?

like image 217
Royeh Avatar asked Feb 03 '26 04:02

Royeh


1 Answers

Change filename_excel to

filename_excel = [my_directory name '_N' num2str(1) '.xlsx'];

where

my_directory = 'C:\some\directory\structure\';

Alternatively (though use the first solution if possible) you can go:

current_dir = cd;
cd my_directory;

filename_excel = [ name '_N' num2str(1) '.xlsx'];
writetable(Table,filename_excel,'Sheet', 3, 'Range','A5');

cd current_dir;
clear current_dir;
like image 108
Ayb4btu Avatar answered Feb 04 '26 20:02

Ayb4btu



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!