Add string to matrix and other operations and then generate text file
1 次查看(过去 30 天)
显示 更早的评论
I have matrix like the following and need to convert by adding strings inside it like the one on this figure:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/330902/image.jpeg)
I attached also excle fle for the orginal matrix and the reuseted mnatrix fomrat in another sheet in the same excle.
Can you help solving this challange by Matlab?
0 个评论
回答(1 个)
SAA
2020-7-19
You can't put chars in a matrix you need to use a cell array for this, then do a cell2table and eventually to get a txt file do
writetable(YourTable,'YouNameIt.txt');
You also not make a table and just use fprirntf with fopene and fclose to save them as a txt file
Something = fopen('YouNameIt.txt');
fprintf(Something, ...); % you get the idea
fclose(Something);
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Text Files 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!