what would be the command to save or open a particular excel data.xls with the designation in a particular drive or folder?
1 回表示 (過去 30 日間)
古いコメントを表示
xlswrite might be the one, but I don't know how to add the information on the destination to save data. Same question to xlsread to search and read a file.
0 件のコメント
採用された回答
Cedric
2017 年 10 月 10 日
編集済み: Cedric
2017 年 10 月 10 日
Here is an example. Make sure that the destination folder exists already. If not or if you have to create destination folders dynamically, use EXIST for testing if they exist already and MKDIR for making them if necessary.
data = randi( 10, 5, 3 ) ;
header = {'A', 'B', 'C'} ;
% - Build cell array of mixed content (strings and numbers).
data = [header; num2cell( data )] ;
% - Concatenate path bits to relevant destination file/folder.
locator = fullfile( '..', 'Data', 'Measures.xlsx' ) ;
% - Build Excel file.
xlswrite( locator, data ) ;
3 件のコメント
Cedric
2017 年 10 月 10 日
編集済み: Cedric
2017 年 10 月 10 日
It was for building a path that targets a folder at the same level as the current folder.
Let's try to write to a file in the same folder first, to eliminate the complication of building a path: does the following work?
header={'a','b','c'};
data=randi(10,5,3);
xlswrite('test.xlsx',data);
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Spreadsheets についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!