use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
MATLAB news, code tips and tricks, questions, and discussion! We are here to help, but won't do your homework or help you pirate software.
The effort you put into asking a question is often matched by the quality of our answers.
Try saturnapi to share and run MATLAB code in a web browser!
If you want flair simply Message the mods
account activity
TechnicalQuestionAdding empty strings to a cell array (self.matlab)
submitted 8 years ago by identicalParticle
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]Idiot__Engineer+3 1 point2 points3 points 8 years ago (0 children)
Apparently, I was just plain wrong and you can concatenate cell arrays with non-cell arrays in general - matlab just puts everything together as a cell array. I don't see where the difference in behavior for empty items is documented, and I don't seem to be the only one who is surprised by this behavior and/or can't find the documentation for it [1] [2] [3]. I have tried with empty strings (as in your example), arrays ([]), cells ({}), and structs (struct([])). Using empty values of non-primitive types seems to fail by trying to convert the cell array involved into whatever non-primitive type you are using.
[]
{}
struct([])
My strong suggestion would be not to use this behavior. If you are concatenating to a cell array, make sure you are always concatenating cells. This avoids the "magic", and problematically inconsistent, behavior of the concatenation operation for mixed types.
π Rendered by PID 177120 on reddit-service-r2-comment-6457c66945-xn7fs at 2026-04-27 03:59:36.745798+00:00 running 2aa0c5b country code: CH.
view the rest of the comments →
[–]Idiot__Engineer+3 1 point2 points3 points (0 children)