Clear Filters
Clear Filters


8 views (last 30 days)
铭义 黄
铭义 黄 on 23 Apr 2023
Answered: Zuber on 10 May 2023

Answers (1)

Zuber on 10 May 2023
I understand that you want to index the last character of a string. This can be done using the ‘end’ keyword as the index value. Here is an example that illustrates the same:-
str = 'Hello'; %string
lastChar = str(end); % indexing the last character
disp(lastChar); % displaying the last character
For more information on ‘end’ keyword, please refer to the following documentation link:
I hope it resolves your query.

Community Treasure Hunt

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

Start Hunting!