Cell Array to output like this?

3 次查看(过去 30 天)
A = 14×1 cell array
{'0.1' }
{'0.2' }
{'1' }
{'1.1' }
{'1.2.3' }
{'1.2.3.1'}
output i want like this
A =
0.1
0.2
1
1.1
1.2.3
1.2.3.1

采纳的回答

the cyclist
the cyclist 2021-8-11
Here is one way:
A = {'0.2','1'}
A = 1×2 cell array
{'0.2'} {'1'}
output = cellfun(@str2num,A)
output = 1×2
0.2000 1.0000
  8 个评论
Stephen23
Stephen23 2021-8-12
No need for CELLFUN when STRCAT can handle that cell array by itself:
A = {'0.2','1.2.3'};
B = strcat('SELECT sum(abc .time_taken) from abc.que_toc_no = ''',A(:),''' ORDER BY abc')
B = 2×1 cell array
{'SELECT sum(abc .time_taken) from abc.que_toc_no = '0.2' ORDER BY abc' } {'SELECT sum(abc .time_taken) from abc.que_toc_no = '1.2.3' ORDER BY abc'}

请先登录,再进行评论。

更多回答(0 个)

类别

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