~ means NOT so *isempty* tells you if the vector is empty and *~isempty* tells you if the vector is _not_ empty. Answer from Adam on mathworks.com
🌐
MathWorks
mathworks.com › matlab › language fundamentals › matrices and arrays
isempty - Determine whether array is empty - MATLAB
TF = isempty(A) returns logical 1 (true) if A is empty, and logical 0 (false) otherwise. An empty array, table, or timetable has at least one dimension with length 0, such as 0-by-0 or 0-by-5. ... Create a 3-D array with one dimension length equal to zero, and determine if it is empty.
🌐
MathWorks
mathworks.com › system identification toolbox
isempty - Determine whether dynamic system model is empty - MATLAB
isempty(sys) returns a logical value of 1 (true) if the dynamic system model sys has no input or no output, and a logical value of 0 (false) otherwise. Where sys is a frd model, isempty(sys) returns 1 when the frequency vector is empty.
🌐
MathWorks
mathworks.com › matlabcentral › answers › 378004-why-is-an-empty-string-not-empty-isempty-returns-true-but-isempty-returns-false
Why is an empty string not empty? isempty('') returns true, but isempty("") returns false - MATLAB Answers - MATLAB Central
January 19, 2018 - Presumably "" is not empty because it is a string object, while '' really is the same as [ ]. But this is a problem for code that tests for empty character input using isempty(...). It no longer works as expected if passed "" instead of ''. Is there a switch we can turn on or off to enable isempty("") to return true? A function written prior to R2016b never needed to check for empty "" (double-quoted) strings, because Matlab would throw an exception if passed something in double quotes.
🌐
MathWorks
mathworks.com › matlab › software development tools › testing frameworks › write unit tests
matlab.unittest.constraints.IsEmpty - Test if value is empty - MATLAB
--------------------- Framework Diagnostic: --------------------- IsEmpty failed. --> The value must be empty. --> The value has a size of [1 3]. Actual Value: 1×3 cell array {0×0 double} {0×0 double} {0×0 double} Test an empty test suite. The test passes. ... Verification passed. ... matlab.unittest.constraints.HasElementCount | matlab.unittest.constraints.HasLength | matlab.unittest.constraints.HasSize | matlab.unittest.constraints.IsScalar | verifyEmpty | verifyThat | isempty
🌐
Northwestern University
ece.northwestern.edu › local-apps › matlabhelp › techdoc › ref › isempty.html
isempty (MATLAB Functions)
tf = isempty(A) returns logical true (1) if A is an empty array and logical false (0) otherwise.
🌐
EDUCBA
educba.com › home › data science › data science tutorials › matlab tutorial › isempty matlab
isempty MATLAB | Guide to Implementation of isempty MATLAB
March 4, 2023 - Calling the isempty function using the input array ‘X’. As we can see in the output, we have obtained logical 0 for an array of dimension 3 x 3 and all the elements as ‘0’. So, this can be concluded that an array with all the elements as zero, is not considered as an empty array. isempty function in MATLAB can also be used for a string array.
Address   Unit no. 202, Jay Antariksh Bldg, Makwana Road, Marol, Andheri (East),, 400059, Mumbai
Find elsewhere
🌐
Reddit
reddit.com › r/matlab › why does isempty return false?
r/matlab on Reddit: Why does isempty return false?
September 1, 2015 -

I am fairly new to MatLab and am using it to inspect an array of strings to determine whether each element contains a string (specifically, the letter 'a'). When prompting isempty(strfind(TEST(1), 'a')), where TEST(1) does not contain an 'a', it returns FALSE (i.e. 0).

strfind(TEST(1), 'a') returns {[]}

Any help resolving this issue and possibly helping me understand why the result is not TRUE (i.e. 1)?

Edit: Wow thank-you for all of the thorough responses. I'll get back to working on my project tomorrow at work. This looks to be a very supportive community - although the submitted posts seem to get downvoted a lot.

🌐
MathWorks
mathworks.com › matlab › language fundamentals › data types › characters and strings
Test for Empty Strings and Missing Values - MATLAB & Simulink
To be an empty array, at least one dimension must have a size of zero. ... Test str using the isempty function.
🌐
MathWorks
mathworks.com › matlabcentral › answers › 797582-isempty-function-does-not-work-for-me
isempty function does not work for me - MATLAB Answers - MATLAB Central
April 9, 2021 - https://www.mathworks.com/matlabcentral/answers/797582-isempty-function-does-not-work-for-me#comment_1450197 ... That is correct. ... The char vector 'x' is not empty.
🌐
MathWorks
mathworks.com › matlabcentral › answers › 769592-different-outcome-cellfun-isempty-vs-cellfun-isempty
different outcome cellfun(@isempty,..) vs cellfun('isempty',...) - MATLAB Answers - MATLAB Central
November 17, 2020 - It turns out that the table data type has an overloaded isempty method. As far as I could find this is not documented. The only solution is as Steven mentions: if you want to make sure you have the expected output, use the non-legacy syntax. If you need to add something that checks the classes of the cell elements all speedup is lost, so you can only use this for cell that you have complete control over. For more context, see this post. Sign in to comment. ... https://www.mathworks.com/matlabcentral/answers/769592-different-outcome-cellfun-isempty-vs-cellfun-isempty#answer_645057
🌐
Quora
quora.com › How-do-you-check-if-a-variable-is-empty-in-MATLAB
How to check if a variable is empty in MATLAB - Quora
Answer: [code]>> doc isempty [/code]Note the distinction in MATLAB between a variable that exists, but has no meaningful value (apart from the null matrix), and a variable that doesn’t exist at all: [code]>> doc exist >> doc clear >> doc clearvars [/code]An empty variable is often a useful signa...
🌐
MathWorks
mathworks.com › mapping toolbox › data analysis › vector data
isempty - Determine if geographic or planar vector is empty - MATLAB
isempty(gp2) ans = logical 0 · collapse all · Geographic or planar vector, specified as a geopoint, geoshape, mappoint, or mapshape object. collapse all · Flag indicating geographic or planar vector is empty, returned as a logical scalar. tf is True when v is empty. Data Types: logical · Introduced in R2012a · You clicked a link that corresponds to this MATLAB command: Run the command by entering it in the MATLAB Command Window.
🌐
RDocumentation
rdocumentation.org › packages › matlab › versions › 1.0.4.1 › topics › isempty
MATLAB isempty function
matlab (version 1.0.4.1) Determine if object is empty. isempty(A) Returns TRUE if x is an empty object; otherwise, FALSE. A · object to evaluate · P. Roebuck proebuck1701@gmail.com · An empty object has at least one dimension of size zero. Run this code ·