loop to assign an array to a string and the create a structure array
1 view (last 30 days)
Show older comments
field_1 = 'Response_1'
field_2 = 'Response_2'
field_3 = 'Response_3'
field_4 = 'Response_4'
field_5 = 'Response_5'
field_6 = 'Response_6'
field_7 = 'Response_7'
field_8 = 'Response_8'
field_9 = 'Response_9'
field_10 = 'Response_10'
field_11 = 'Response_11'
field_12 = 'Response_12'
field_13 = 'Response_13'
field_14 = 'Response_14'
field_15 = 'Response_15'
field_16 = 'Response_16'
field_17 = 'Response_17'
field_18 = 'Response_18'
field_19 = 'Response_19'
field_20 = 'Response_20'
s = struct(field_1,FR_1(:,2),....
filed_20,FR_20(:,2))
How can I create a loop to assign an array (Response_1 to Response_20) to a string (field_1 to field_20) and then create another loop to create a structure array (s) that contains Response_1 to Response_20?
1 Comment
Stephen23
on 30 Jul 2019
Why not just use indexing?
Indexing would be much simpler and much more efficient that what you are trying to do.
Answers (0)
See Also
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!