how to identify empty , non-empty char matrix condition?
4 views (last 30 days)
I have a matrix "A" with size 4x8 char and having values:
I want to identify the index of empty char. I.e. 3rd one.
% first one
A == ""
% second one
A == ''
% third one
% forth one
% fifth one
A == ' '
% sixth one
A == " "
% everything shows zero output.
Can anyone please help?
Any help will be greatly appriciated.
Stephen23 on 18 Jul 2022
Edited: Stephen23 on 18 Jul 2022
M = [...
strcmp('',cellstr(M)) % CELLSTR removes trailing whitespace characters.
cellfun(@isempty,cellstr(M)) % CELLSTR removes trailing whitespace characters.
all(M==32,2) % match space character only.
all(M==' ',2) % match space character only.
all(isstrprop(M,'wspace'),2) % match any whitespace character.