Change cell object to char

4 visualizaciones (últimos 30 días)
Emily Doherty
Emily Doherty el 3 de Nov. de 2022
Comentada: Fangjun Jiang el 3 de Nov. de 2022
How can I convert the name object to be a char instead of a cell?
Thank you very much.
Emily

Respuestas (1)

Fangjun Jiang
Fangjun Jiang el 3 de Nov. de 2022
a={'abc'}
a = 1×1 cell array
{'abc'}
whos a
Name Size Bytes Class Attributes a 1x1 110 cell
b=char(a)
b = 'abc'
whos b
Name Size Bytes Class Attributes b 1x3 6 char
  4 comentarios
Emily Doherty
Emily Doherty el 3 de Nov. de 2022
My cell array is only one cell. I get this error when I try to follow that logic
>> SubjStats(1, 1).basis.stim.values{1, 1}.name = char(SubjStats(1, 1).basis.stim.values{1, 1}.name)
Error using strcmp
Too many input arguments.Error in Dictionary/subsasgn (line 233)
if strcmp(s.type,'()')
Fangjun Jiang
Fangjun Jiang el 3 de Nov. de 2022
Might it be that this field 'name' in that nested structure requires a cell of string?
try
SubjStats(1, 1).basis.stim.values{1, 1}.name='abc'

Iniciar sesión para comentar.

Categorías

Más información sobre Characters and Strings en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by