Effacer les filtres
Effacer les filtres

Cell Array to output like this?

3 vues (au cours des 30 derniers jours)
Divyesh pandav
Divyesh pandav le 11 Août 2021
Modifié(e) : Divyesh pandav le 12 Août 2021
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 commentaires
Rik
Rik le 11 Août 2021
What is flagging your own question going to achieve? You can post comments and even edit your question to clarify it.

Connectez-vous pour commenter.

Réponse acceptée

the cyclist
the cyclist le 11 Août 2021
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 commentaires
Divyesh pandav
Divyesh pandav le 12 Août 2021
thank you so much
Stephen23
Stephen23 le 12 Août 2021
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'}

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Characters and Strings dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by