Return textual stringdata without primes

1 次查看(过去 30 天)
Hi all,
I need to set up some strings with words, e.g.
C=['Horse' 'Apple' 'House' 'Van']
and then read in the different words again in another part of the program. However, if I read back these data , I get the word with primes, namely
C(1)='Horse'
and I need to get the words without the primes. I tried the character command, but then the answer is C(1)=H. Does anyone have a tip how to deal with this?
Thanks,
Ellen
  6 个评论
Ellen
Ellen 2014-9-24
When I apply a cell array as I described above and try to write it to file usinf frintf, I get the following error message:
Error using fprintf
Function is not defined for 'cell' inputs.
Apparently fprintf is not suitable for handling cell arrays.
Adam
Adam 2014-9-24
Can you give an example of exactly what you are trying to do? Are you trying to print:
'Horse Apple House Van'
to file?

请先登录,再进行评论。

回答(1 个)

dpb
dpb 2014-9-22
The "primes" (actually single quotes) are a figment of Matlab's display of cell strings--they aren't really a portion of the string itself.
As Adam notes, using a cell array will aid in using strings as then they cell contents are referenced instead of a single character and requiring 2D subscripts to reference a full string with character arrays.
A specific use also would be beneficial to amplifying this answer to a specific usage.

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by