MATLAB Answers

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

16 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';
file_names = {};
index1 = 1;
while index1 <= 1 %80
finger_features=struct('X', [], 'M', [], 'O', [], 'R', [], 'N', [], 'RO',[], 'OIMG', [], 'OREL', []);
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('', 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);
file_a = file_names(index1);
file_a = substring(char(file_a), 0, findstr(char(file_a), '_')-2);
index1 = index1 + IMPRESSIONS_PER_FINGER;

  1 Comment

Stephen Cobeldick
Stephen Cobeldick on 18 Nov 2018
You appear to be storing your user files in the MATLAB installation folder:
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


Show 1 older comment
Walter Roberson
Walter Roberson on 18 Nov 2018
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 .

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!