필터 지우기
필터 지우기

Cell Array to output like this?

조회 수: 3 (최근 30일)
Divyesh pandav
Divyesh pandav 2021년 8월 11일
편집: Divyesh pandav 2021년 8월 12일
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
  댓글 수: 2
Rik
Rik 2021년 8월 11일
What is flagging your own question going to achieve? You can post comments and even edit your question to clarify it.

댓글을 달려면 로그인하십시오.

채택된 답변

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
Divyesh pandav
Divyesh pandav 2021년 8월 12일
thank you so much
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