How can I access char elements from the beginning up to some fixed index of the char?
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Daniel
le 7 Déc 2022
Réponse apportée : Steven Lord
le 7 Déc 2022
a = char(abdefghijk);
I want the output 'abcdefg'
0 commentaires
Réponse acceptée
Plus de réponses (2)
Vikram Ojha
le 7 Déc 2022
Modifié(e) : Vikram Ojha
le 7 Déc 2022
>> a='abcdefghijk'
>> a(1:5)
ans =
'abcde'
In genral a(1:n) % n for index
You can consider going through following doc: https://in.mathworks.com/help/matlab/ref/string.html, it will be helpful
In case you want you can take Matlab fundamental certification: https://matlabacademy.mathworks.com/details/matlab-fundamentals/mlbe
Voir également
Catégories
En savoir plus sur Matrix Indexing dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!