I got many strings from our device (array). There are two different kinds of strings :
- 011_c_srr_Rtzfi_at000_hh5_fs_v343_l067_i1_Test_Test
- 041_c_ddr_Rtzfi_ds000_hh5_fs_v343_l037_i1_Test_hall (the needed information is in the middle of the string)
- 061_t_err_Rsas_au000_ti3_fs_v777_l011_ *
- 021_t_err_Rsas_au230_ti3_fs_v777_l031_ (the needed information is at the end of the string)
Conclusion: I need the following part of the string l067 / l037 / l011 ..... For example l067 means 67% and I037 means 37%. So i need this two percent values. The result is 67 and 37. My Code: (only parts)
for j=1:numRows;
Name=LaSP.Messung(j, 1).name
Size=size(Name)
Length = strlength(Name)%Evaluiert die Länge des gesamten Strings
pos1 = findstr(Name, '_')%Listet alle "_" im String auf
[zeile1,spalte1]=size(pos1)
spalte=pos1(1,spalte1)%ich hol mir string position vom letzten "_"
if spalte==Length%Abfrage ob das letzte zeichen ist ein "_"
%%Abfrage ob der Wert schon einmal vorkam
%%die letzten 4 auslesen
else
%%in mitten des strings
end
%pos = strfind(Name, '_')
%k = strfind(Name,'_','ForceCellOutput',true)
%idx = find(strcmp(Name, '_'))
%pat='_';
%ind=regexp(Name,pat);
% word_to_find=strfind(strarray,'stringtofind');
% starray.index(word_to_find);
end
My problem is i can not split the string ... i can not extract the last 4 characters... Thank you
strplit()on the dash,_, and then grab the ninth cell.