From: Jan Simon on
Dear Nicholas,

> Using perl, I'm able to detect if a regex matches by doing an if statement - is this possible in MatLab, or would I just need to check if the results are empty?

In Matlab
if <expression>
is equivalent to
if all(reshape(<expression>, 1, [])) && ~isempty(<expression>)
(Am I right? It looks so strange...)
This is at least complicated, grown historically or even confusing.
To support easy debugging I'd suggest:
if ~isempty(regexp(...))
In older Version this was some nano-seconds faster:
if length(regexp(...)) % equivalent to "length(regexp(..)) ~= 0"
But using LOGICALs in IF seems to be as fast as DOUBLEs currently. And saving nano-seconds is negligible even if you call it millionth of times...

Kind regards, Jan