txt file content : 2;123687452321215454 I would like to get the fist character "2"
I tried :
s = fileread(filepath);
[token, remain] = strtok(s)
token =
this returns :
token =
2;123687452321215454
remain =
how could I get only the first "2" ?
If you want to get whatever is before the ;
, use:
[token, remain] = strtok(s,';')
This will give you more than one character if that's what there is before the ;
. If you just want the first character, use token(1)
. If you want the last character before the ;
use token(end)
.