Strings of characters

조회 수: 1 (최근 30일)
James Tuck
James Tuck 2011년 2월 5일
Hey, I'm a first year undergraduate, new to matlab, and so am not familiar with many of it's functions.
I have a question involving a string of characters, ie '0123456789' and I can have a working solution if I can select the nth number along, ie here the 5th number = 4.
Is there a simple way to do this, or for example a way to turn '0123456789' into the array [0,1,2,3,4,5,6,7,8,9]?

채택된 답변

Walter Roberson
Walter Roberson 2011년 2월 5일
The nth character of a string is
StringName(n)
To convert a string containing the characters of digits, in to an array with the corresponding numeric digits, use
StringName - '0'

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Characters and Strings에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by