Joining two columns and exporting to excel
4 ビュー (過去 30 日間)
古いコメントを表示
Hello,
I have the following arrays, I want to join them into one matrix and export them as .xlsx file.
be mindful thae B is datetime, i tried to do it in the simple way creating a matrix but it gives error, any conversion may be needed here ?
thanks
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1045575/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1045580/image.png)
0 件のコメント
採用された回答
その他の回答 (2 件)
Abderrahim. B
2022 年 6 月 25 日
編集済み: Abderrahim. B
2022 年 6 月 25 日
Hi !
You are trying to concatenate datetime array with an array of data type double that is why you got that error.
- Check this answer maybe it answers your question.
- Here is another way that I propose to export to spreadsheet.
- Create a table and populate it with your 2 arrays
- Use writetimetable to export to excel.
%% Example
% Dummy arrays
dTime = datetime(2013,11,1,8,0,0):datetime(2013,11,20,8,0,0) ;
fArray = 1:20 ;
% Populate the table
concatArrays = timetable(transpose(dTime), transpose(fArray), 'VariableNames',"Number" ) ; % transpose the array if they are row vectors
% Export to excel
writetimetable(concatArrays, 'Concatenated.xlsx')
Hope this solves your issue!
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!