Effacer les filtres
Effacer les filtres

Import data from GUI into cell

1 vue (au cours des 30 derniers jours)
faizal
faizal le 9 Fév 2011
How to import data from GUI edit text into cell?
Example: 'a b c' in GUI, in workspace each character created in individual cell.
TQ

Réponses (1)

Martijn
Martijn le 9 Fév 2011
Suppose you have:
A = 'a b c';
Possibly obtained by:
A = get(handles.myTextEdit,'String');
Then to get each character (including spaces) separately, you can use:
>> B = num2cell(A)
B =
'a' ' ' 'b' ' ' 'c'
Or if you want to only get the actual letters, i.e. split on the space character, you could use REGEXP:
>> C = regexp(A,' ','split')
C =
'a' 'b' 'c'

Catégories

En savoir plus sur Cell Arrays 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