How can I access char elements from the beginning up to some fixed index of the char?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Daniel
am 7 Dez. 2022
Beantwortet: Steven Lord
am 7 Dez. 2022
a = char(abdefghijk);
I want the output 'abcdefg'
0 Kommentare
Akzeptierte Antwort
Weitere Antworten (2)
Vikram Ojha
am 7 Dez. 2022
Bearbeitet: Vikram Ojha
am 7 Dez. 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
Siehe auch
Kategorien
Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!