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);
9 ビュー (過去 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
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
2018 年 11 月 18 日
編集済み: madhan ravi
2018 年 11 月 18 日
AFAIK: There is no such syntax as substring() in matlab
see
4 件のコメント
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 .
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Startup and Shutdown についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!