Undefined function 'substring' for input arguments of type 'char'. Error in extract_db (line 45) file_a = substring(char(file_a), 0, findstr(char(file_a), '_')-2);

조회 수: 12 (최근 30일)
What is the substitute function to evaluate file_a = substring(char(file_a), 0, findstr(char(file_a), '_')-2); because this function is not executing in matlab 2016
%%
files = dir('E:\MATLAB\R2016b\bin\img\PCA\my_PhD_Programs\minuite\sc_minutia\Db1_a\*.tif');
cd 'E:\MATLAB\R2016b\bin\img\PCA\my_PhD_Programs\minuite\sc_minutia\Db1_a';
IMPRESSIONS_PER_FINGER=8;
file_names = {files.name};
index1 = 1;
while index1 <= 1 %80
finger_features=struct('X', [], 'M', [], 'O', [], 'R', [], 'N', [], 'RO',[], 'OIMG', [], 'OREL', []);
for i=0:IMPRESSIONS_PER_FINGER-1
finger_features = extract_finger(char(file_names(index1 + i)));
file_a = file_names(index1 + i);
fOut = sprintf('%s.X', char(file_a));
csvwrite(fOut, finger_features.X);
fOut = sprintf('%s.m', char(file_a));
csvwrite(fOut, finger_features.M);
fOut = sprintf('%s.o', char(file_a));
csvwrite(fOut, finger_features.O);
fOut = sprintf('%s.r', char(file_a));
csvwrite(fOut, finger_features.R);
fOut = sprintf('%s.n', char(file_a));
csvwrite(fOut, finger_features.N);
fOut = sprintf('%s.ro', char(file_a));
csvwrite(fOut, finger_features.RO);
fOut = sprintf('%s.oi', char(file_a));
csvwrite(fOut, finger_features.OIMG);
fOut = sprintf('%s.or', char(file_a));
csvwrite(fOut, finger_features.OREL);
end
file_a = file_names(index1);
file_a = substring(char(file_a), 0, findstr(char(file_a), '_')-2);
index1 = index1 + IMPRESSIONS_PER_FINGER;
end
  댓글 수: 1
Stephen23
Stephen23 2018년 11월 18일
You appear to be storing your user files in the MATLAB installation folder:
'E:\MATLAB\R2016b\bin\img\PCA\my_PhD_Programs\minuite\sc_minutia\Db1_a\*.tif'
User data should never be stored in any application's installation folder.

댓글을 달려면 로그인하십시오.

채택된 답변

madhan ravi
madhan ravi 2018년 11월 18일
편집: madhan ravi 2018년 11월 18일
  댓글 수: 4
Walter Roberson
Walter Roberson 2018년 11월 18일
There is a MuPad substring function but it would be a nuisance to use from matlab proper.
There is a java substring but it would not work on char arguments .
madhan ravi
madhan ravi 2018년 11월 18일
The second information is new to me sir Walter thank you :)

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by