Dear all,
I am currently trying to derandomize a list of filenames. I do have a derandomization sheet for this. However, whenever I am trying to run the script I wrote for this I encounter the following error:
Error using strfind
PATTERN must be a string scalar or character vector.
Error in Derandomization (line 14)
idx = find(~cellfun(@isempty,strfind(N,C)))
This is my code:
clearvarsclose allbasicpath = ('C:\path');[~,~,raw] = xlsread('filenames_new_sheet.xlsx');T = readtable('derandomization.xlsx');t = T{:,'Filename'}newStr = erase(t,'_kakaka'); %get body of filenames to match
C = unique(newStr) % delete filenames that exist more than once
N = raw(:,2); runrj = size(C)k = size(N)for n = 1:j for m = 1:kidx = find(~cellfun(@isempty,strfind(N,C)))endend
>> class N
ans =
'char'
>> class C
ans =
'char'
Why do I keep getting this error message everytime? And what can I do to avoid it? Thank you, everyone.
Kindly
Best Answer