How can we convert struct file to txt file?
4 次查看(过去 30 天)
显示 更早的评论
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/533334/image.png)
We have a 5x1 struct file as you can see in the picture. IDs represent the names of the patients, so we have 5 patients. We want to save sounddata and flow data for each patient separately as txt file.
0 个评论
采纳的回答
dpb
2021-2-27
arrayfun(@(s) writematrix([s.S s.F],[s.ID '.txt']),structWheeze)
4 个评论
dpb
2021-2-28
That's what arrayfun does ... did you try it and see what you got?
>> dir yk*.txt
yk103.txt yk104.txt
See??? There are two elements of the sample struct and two text files were created with the IDs in the array...
>> structWheeze.ID
ans =
'yk103'
ans =
'yk104'
>>
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Structures 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!