i am searching a folder for text files and i am adding those files found into a new array called mytext
this is my code
function fileList = removeElements(fileArray)
x = 1;
mytext = [];
for idx = 1:numel(fileArray)
if (~isempty(strfind(fileArray(idx),'.txt') ))
mytext(x) = fileArray(idx)
x=x+1;
end
end
end
But iam getting a error
??? The following error occurred converting from cell to double:
Error using ==> double
Conversion to double from cell is not possible.
Error in ==> removeElements at 10
mytext(x) = fileArray(idx)
How can i overcome this ?
Strings are generally stored in cell arrays. So you need to index with
{}, not():