[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: convert cell in string
From: |
Andreas Weber |
Subject: |
Re: convert cell in string |
Date: |
Sun, 15 Jul 2018 11:24:33 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 |
Am 14.07.2018 um 10:39 schrieb turbofib:
> the reason why I want to convert the data type is to use substr()
Ah, a typical XY problem.
You are asking how to "convert a cell to string" but
what you really want to do is to run "substr" on a cell string.
The solution for this is to use "cellfun":
octave:> cellfun (@(x) substr (x, 1, 2), {"foo", "hello", "world"},
"UniformOutput", false)
ans =
{
[1,1] = fo
[1,2] = he
[1,3] = wo
}
-- Andy
Re: convert cell in string, PhilipNienhuis, 2018/07/14