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);

41 views (last 30 days)
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 Comment
Stephen23
Stephen23 on 18 Nov 2018
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.

Sign in to comment.

Accepted Answer

madhan ravi
madhan ravi on 18 Nov 2018
Edited: madhan ravi on 18 Nov 2018
  4 Comments

Sign in to comment.

More Answers (0)

Categories

Find more on Environment and Settings in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!