Filter löschen
Filter löschen

How can we convert struct file to txt file?

4 Ansichten (letzte 30 Tage)
furkan akhan
furkan akhan am 27 Feb. 2021
Kommentiert: dpb am 28 Feb. 2021
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.

Akzeptierte Antwort

dpb
dpb am 27 Feb. 2021
arrayfun(@(s) writematrix([s.S s.F],[s.ID '.txt']),structWheeze)
  4 Kommentare
furkan akhan
furkan akhan am 28 Feb. 2021
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 am 28 Feb. 2021
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'
>>

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Structures finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by