필터 지우기
필터 지우기

How can we convert struct file to txt file?

조회 수: 4 (최근 30일)
furkan akhan
furkan akhan 2021년 2월 27일
댓글: dpb 2021년 2월 28일
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.

채택된 답변

dpb
dpb 2021년 2월 27일
arrayfun(@(s) writematrix([s.S s.F],[s.ID '.txt']),structWheeze)
  댓글 수: 4
furkan akhan
furkan akhan 2021년 2월 28일
thank you so much! i fixed it but there is a little problem that i couldnt fix. I coulndnt assign a loop i mean if there are 20 patients i dont wanna write code for one by one. Instead of this i wanna assign a loop and it will show me all patients txt files. can you help me?
dpb
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 CenterFile Exchange에서 Structures에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by