MATLAB newbie: how to index a string array?

Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
1 replies · 13K views
bzz77
Messages
33
Reaction score
0
I'm a Matlab newbie. I have an array of strings, for example:

header = {'Fred', 'Tom'}

When I do:
header(1)

I get 'Fred'

I want to be able to change elements--for example:
header(1) = 'Jill'

But I get this error:
? Conversion to cell from char is not possible.

I would be very grateful for advice. If it isn't possible to do this, is there some other container I could use for storing and changing strings? The strings will form a header row for matrix columns output to a file. Thanks a lot.
 
on Phys.org
It should be:
header(1) = {'Jill'}