Problem in convert cell to string.

1 次查看(过去 30 天)
I have a cell show like this
% code
val =
title="
google
">
The value is 3*7 char. If I want to convert into string to be ---> title="google"> What can I do? I have found many solution but can't help for this one. Thank you.

采纳的回答

Guillaume
Guillaume 2015-1-7
Possibly, this is what you want:
strjoin(cellstr(val), '')
  5 个评论
Guillaume
Guillaume 2015-1-7
In that case, my code works:
>> val = ['title="'
'google '
'"> '];
>> whos val
Name Size Bytes Class Attributes
val 3x7 42 char
>> strjoin(cellstr(val), '')
ans =
title="google">

请先登录,再进行评论。

更多回答(1 个)

Sean de Wolski
Sean de Wolski 2015-1-7
S = reshape(A',1,[])
No reason to convert to and from a cell.
  3 个评论
Sean de Wolski
Sean de Wolski 2015-1-7
编辑:Sean de Wolski 2015-1-7
Ahh, I didn't realize cellstr implicitly calls deblank. Good to know!

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Characters and Strings 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by