General
Follow


What parts of MATLAB would you not miss?

Walter Roberson on 21 Feb 2011
Latest activity Reply by Rik on 16 Mar 2022

Are there parts of MATLAB that could disappear as far as you were concerned, things you don't need or which were "bad ideas" or which cause more trouble than they are worth in your experience?
One suggestion per answer please, so we can see how other people feel about the same matters.
Steven Lord
Steven Lord on 2 Oct 2020
Tim Harmon: Depending on your license and what you need to use MATLAB to do, this may be possible. See MATLAB Online.
Tim Harmon
Tim Harmon on 2 Oct 2020
Installing MatLab
\
Seth Wagenman
Seth Wagenman on 31 Aug 2020
Admin permission required to install python API. No other python modules I have ever used require this:
https://www.mathworks.com/help/matlab/matlab_external/install-the-matlab-engine-for-python.html?s_tid=srchtitle
Greg
Greg on 15 Feb 2018
Now that I've been forced into Linux at work, I wouldn't miss ls for a minute. It behaves horribly compared to in Windows, and means my code is not cross platform.
I've spent the last 2 days replacing every instance with
a = dir();
a = {a.name}';
Greg
Greg on 15 Feb 2018
Commenting on another answer just reminded me of something else:
eval(...)
Ok, I'll be honest. There's that one time I just couldn't do anything else, but I hate myself everyday for caving into eval. I would miss it just a little bit, but I would actually feel better if it was gone.
Rik
Rik on 16 Mar 2022
Since R2022a str2num provides a switch to only allow basic operations. It should have been the default, but suddenly there is a way to use str2num without opening a gaping hole in your program:
str2num('[1 2;3 4]',Evaluation='restricted')
ans = 2×2
1 2 3 4
str2num('disp("I''m a trickster!")',Evaluation='restricted')
ans = []
Walter Roberson
Walter Roberson on 15 Feb 2018
There is a niche of programs intended to graph (or do root solving) of user-supplied equations. Some of those are just homework assignments, but some of them are serious tutorial work or convenience graphics calculators.
In those cases, it can be difficult to resist using eval(). str2func() does help but it does not always work, and when I use it I still feel nausea to some extent as I know that I haven't done the slightest thing to prevent the security risks.
There is need for a "sandbox" function that can evaluate untrusted code (especially given as string) in a safe environment that does not allow file output and only allows file input of files the caller of sandbox specifically injects into the sandbox (which, sigh, people would tend to do without verification of trust.)
Greg
Greg on 14 Feb 2018
And now for my own "wouldn't miss it" feature:
finish.m
I have never used it, have never considered using it or thought it might be a solution to my problem, and haven't heard of a good use for it. Except the one guy that used it in some coworker-trolling code.
Greg
Greg on 15 Feb 2018
Honestly, ability to use old releases is almost on my list of wish it wasn't possible.
I know R2007a was a popular "cracked" version, haven't heard anything since then, but haven't researched it either.
I can imagine professors insisting on old releases because they don't include some of the new features that make the assignment completely trivial. A lot of my coursework included "do not use the built-in [function_name], write your own." A release that doesn't include said built-in makes it a lot easier on the professor.
Walter Roberson
Walter Roberson on 15 Feb 2018
These days I seem to be regularly advising people who turn out to be using 2010a or 2011b or 2012a or 2012b or 2013b, sometimes 2008a or sometimes even R13. The requests seem to clump together, with the completely obsolete versions not getting mentioned for a while and then suddenly it is almost as if some university class has required that students use something old.
To be honest, sometimes I wonder if those old version numbers correspond to popular cracks, if that is the reason why more people than one might expect show up using the old versions. And yes, that includes in assignments from professors (that is, I do get the impression some times that some professors are using old cracked versions and that is the reason why they insist that students use something so obsolete.)
Greg
Greg on 15 Feb 2018
As to question 95875, that was fixed in R2014b.
To the others - fair enough; not something I've needed to do yet.
Walter Roberson
Walter Roberson on 15 Feb 2018
I seem to recall another use as well. Perhaps something along the line of forcing a connection to shut down, as some kinds of resource reservation persist past the program shutting down. For example if you are using ActiveX to talk to a shared server then the server doesn't know that your program has disappeared and that it needs to do (whatever).
Jan
Jan on 15 Feb 2018
Matlab 6.5 crashed, when it was stopped by exit during an audioplayer object is existing. Therefore I added a function in finish.m, which clears all of my functions calling audioplayer. In addition a backup of all modified M-files is triggered.
Star Strider
Star Strider on 14 Feb 2018
@Greg — Thank you for reviving this thread. I didn’t know it existed.
For me, it would be ‘automatic array expansion’, introduced (if I remember correctly) in R2016b.
Can’t everyone just learn to use bsxfun? It’s not that difficult!
Kenn Sebesta
Kenn Sebesta on 9 Oct 2020
@Star Strider has it exacly right. In fact, implicit expansion is why I stopped using Matlab in favor of Julia. Matlab is a tool and tools should save me time, but starting in 2017 this fundamentally changed. Implicit expansion, as implemented, was costing me far more time than it ever saved, in similar ways to https://www.mathworks.com/matlabcentral/answers/383533-how-do-i-avoid-getting-fooled-by-implicit-expansion.
Julia just makes implicit expansion pedantic, and it works far better in terms of time spent writing code vs. hunting down accidental dimension mistakes. @Stephen Cobeldick offers some good ideas for how to fix this.
I periodically check back in with Matlab to see if this has been fixed, but alas as @J. Alex Lee points out there is not much active discussion on this point.
J. Alex Lee
J. Alex Lee on 17 Jun 2020
so does anyone know why, in the end, it was decided that silently implict syntax for implicit expansion was a better idea than introducing an explicit syntax along the lines of what Stephen said above with different types of binary operators (actually i dont even know what expanding matrix ops means)?
I embraced implicit expansion because for whatever reason I couldn't keep bsxfun syntax straight in my mind, but now I'm being bitten enough by it with inadvertent usage that I've been driven to seek blogs and discussion about this design decision...can't find much since some flurry of activity in 2016 upon introduction and some discussion in 2018...
Jan
Jan on 15 Feb 2018
@Greg: Unfortunately the implicit expansion is sometimes substantially slower than bsxfun.
@Stephen: I agree that these different operators would be useful to avoid bugs. Currently a line of code, which relies on implicit expansion is only clear and clean, if you add a comment, that this is intended.
Stephen23
Stephen23 on 15 Feb 2018
It would be nice to have four different kinds of binary operator (and transpose):
  1. strict element-wise
  2. expanding element-wise
  3. strict matrix operations
  4. expanding matrix operations
I came up with a reasonable syntax, but it is not compatible with MATLAB.
Other (recently developed) "scientific" languages that I have used/experimented with seem to be written by programmers for programmers: apparently any thoughts of real mathematics rules being applied was the last thing on their minds.
Greg
Greg on 14 Feb 2018
It's formally called implicit expansion, and it's amazing. Supposedly faster than bsxfun in most cases.
And you are welcome.
Greg
Greg on 14 Feb 2018
I stumbled across this question and thought it would be fun to revive it. A lot has changed, so I wonder how many are still "unmissable," might not be applicable anymore, or any new additions.
Wes
Wes on 24 Jun 2011
Class events. Does anybody actually use these?
The model for these in MATLAB is a little strange. For instance, listeners keep a reference to the object they are listening to, thereby preventing that object being destroyed. The reference is unnecessary given that events are a 'push' mechanism.
This makes the ObjectBeingDestroyed event defined on handle useless, becuase as soon as you listen for it, you prevent the event from ever firing! (Barring evil explicit calls to delete.) It's the ol' watched kettle that never boils.
Greg
Greg on 14 Feb 2018
Class events are awesome. As for listeners keep references, that's precisely the difference between handle.listener and handle.addlistener. You get to choose whether the source holds the reference or the listener holds the reference.
per isakson
per isakson on 7 Apr 2014
I use them and don't want to be without. However, I cannot say whether the implementation in Matlab is the best.
Wes
Wes on 24 Jun 2011
We do not need deterministic finalisation for reference types, especially when they form part of a reference cycle. More simply put, we don't need MATLAB to go to great lengths to guarantee it will call the delete method on (and free the memory of) objects the very instant that they are no longer used.
The fact that MATLAB has this feature is apparently the cause of performance-sapping overhead. Case in point: it takes O(n) time to get or set a single element in a cell array if that array is a property of a reference-typed object. Try building an O(1) collection class with that restriction!
I'm not aware of any other runtime with managed memory that wastes time giving this guarantee. CPython uses reference-counting similar to MATLAB, but doesn't have deterministic finalisation for objects in a cycle. Java and .NET of course don't have deterministic finalisation for any objects!
The MATLAB language really would be better off though with support for a proper finally block instead.
Krishna Kumar
Krishna Kumar on 24 Jun 2011
My pick would be obsolete tools like gatool, which can now be accessed via optimtool.
Steven Lord
Steven Lord on 15 Feb 2018
The gatool interface was removed in release R2015b.
Wes
Wes on 24 Jun 2011
I think we could do without one curious perversion of functions: a function where you don't pass a variable's value, but you pass the name of the variable instead! I'm lookin' at you, save():
save( 'foo.mat', 'x' );
Rik
Rik on 16 Mar 2022
The code analyzer now correctly picks up on these uses.
myVar = rand(10,1); % no linter warning
save('Test.mat','myVar');
Even the mass name replacements work.
My minify function is not yet updated to deal with this, so I'm still using tools like I described a year and a half ago.
Rik
Rik on 31 Aug 2020
I personally use a separate function to save variables to a mat file. It includes a timestamp and the name of the function that created it. It also makes sure Octave uses the Matlab format, and that Matlab 6.5 can read the files. Using this function I can actually use the tools to change all occurence of the variable names (and the linter doesn't complain anymore). 10 minutes to find inputname and 10 minute to implement the function. 20 minutes of my life that have probably saved me 5 years worth of life span by prevent blood pressure spikes.
Stephen23
Stephen23 on 15 Feb 2018
I suspect that this is closely related to the origins of MATLAB: back when the height of programming sophistication was a glowing green monitor (80 characters wide) and the use of command syntax for everything. In that context save, load, etc make sense, because command syntax requires that the input must be interpreted as a literal string, and thus can only represent the variable name. Perhaps it was even considered good language design at the time?
Sadly we are now stuck with these strange remnants...
Greg
Greg on 14 Feb 2018
I agree with Walter here, but it is a painful lesson to learn the first 5 times. My problem with save is the Code Analyzer barking that a variable might be unused (or unset in the case of load).
myVar = rand(10,1); % 'myVar' may be unused
save('Test.mat','myVar'); <-- I use it right here Code Analyzer!
Walter Roberson
Walter Roberson on 24 Jun 2011
People *do* construct (compute) the name of the variable to save, and thus need to be able to pass a variable that contains a string but that variable is not itself the thing to be saved.
Andrew Newell
Andrew Newell on 24 Jun 2011
I wonder if they're worried about people doing stuff like save('foo.mat',@tan(x))?
Andrew Newell
Andrew Newell on 24 Jun 2011
They could easily implement a version that accepts variables in the usual manner. I could do it myself using inputname.
Krishna Kumar
Krishna Kumar on 24 Jun 2011
I think thats tough. save compares the names given to ones in the workspace, and saves them, I suppose.
Aurelien Queffurust
Aurelien Queffurust on 24 Jun 2011
I never used the "Start" Button which provides access to tools, demos, shortcuts, and documentation. I would be very curious to know if you are using it !!
I already asked this question on the "Mike on the MATLAB Desktop" blog: MATLAB User Survey (and maybe a free polo shirt) after answering their survey.
Greg
Greg on 14 Feb 2018
Not anymore. =)
Walter Roberson
Walter Roberson on 25 Jan 2012
There's a "Start" button?
Sean de Wolski
Sean de Wolski on 24 Jun 2011
I use it frequently to get to demos for various toolboxes. Sorry to rain on the parade...
Andrew Newell
Andrew Newell on 24 Jun 2011
I never use that either. Maybe it's designed for people who work on Windows machines, use the tools a lot or aren't old MATLAB users who are set in their ways.
Jan
Jan on 21 Feb 2011
I never use multi-row CHAR arrays.
Walter Roberson
Walter Roberson on 15 Feb 2018
"there is no obvious mechanism to cellstr() an sprintf() output"
Jan put me on to sprintfc() . Which, oddly, turns out to go across rows instead of down columns.
sprintfc('%d, %d, %d.', [[1;2], [3;4], [5;6]])
ans =
2×1 cell array
{'1, 3, 5.'}
{'2, 4, 6.'}
Greg
Greg on 14 Feb 2018
Yay for string data type! As soon as it is fully functional, I doubt I'll ever use char again.
Jonas Reber
Jonas Reber on 24 Jun 2011
I use them quite often... mostly for UI related things
Jan
Jan on 21 Feb 2011
I'm using a modified version of DEC2BIN, which assigns UINT8 arrays instead of a CHAR. This uses the half memory and the export to a Mex is more direct.
Walter Roberson
Walter Roberson on 21 Feb 2011
This is one that I do actually use, and which I think has a lot of internal uses. For example, dec2bin() applied to a vector produces a multi-row char array.
I create formatted output by horzcat'ing together blocks of text. Although that sometimes has relationships to things that could be done through appropriate sprintf(), the char array approach is faster -- and there is no obvious mechanism to cellstr() an sprintf() output (regex split is too much overhead for such a thing.)
Sean
Sean on 21 Feb 2011
I wish the MathWorks would not "dumb things down". This is especially apparent in the GUI development tools, but there are other examples also. Why are the powerful capabilities of the underlying java GUI objects hidden from the user? There is a whole market for utilizing this capability that drives websites like http://www.undocumentedmatlab.com/. People want/need to be able to access this functionality. Thanks to Yair Altman, I have been able to include some of the functionality that I need. But it is so painful (and questionable for future compatibility), the question of whether to use Matlab at all is difficult to justify with my peers.
I suspect that one of the concerns here is the complexity of supporting advanced functionality. I think that sometimes the need to support the basic user overshadows the needs of people who want everything a GUI has to offer. Most unfortunate.
Paulo Silva
Paulo Silva on 21 Feb 2011
quit
I would never miss that function because matlab is always open on my laptop :)
Steven Lord
Steven Lord on 17 Jun 2020
FYI in the Preferences for MATLAB, the General section has an item for Confirmation Dialogs. One of the dialogs you can enable (it isn't on by default) is "Confirm before exiting MATLAB".
Walter Roberson
Walter Roberson on 17 Jun 2020
I just got bit a few minutes ago, went to dbquit and accidentally quit instead, accidentally closing my session :(
Greg
Greg on 15 Feb 2018
Really? Cool (in the "I didn't know that" meaning, not the "that's an awesome way for it to behave" meaning).
Walter Roberson
Walter Roberson on 15 Feb 2018
Clicking the x on the desktop is not the equivalent to quit or exit: any GUI that has been opened on your behalf that uses internal figures (perhaps Java based) can survive being x'd. x'ing the desktop does not reliably close Simulink windows, for example.
Greg
Greg on 15 Feb 2018
Clicking the x in the MATLAB desktop (not the Editor or a running app, etc.) is equivalent to quit or exit.
Point taken for testing framework - I'm still working toward that.
Walter Roberson
Walter Roberson on 15 Feb 2018
Clicking the x in the corner only gets that one window, not all of the other windows one might have open.
But with respect to wanting to programmatically kill a MATLAB session: Running in an automated mode where you know the session is finished. Especially in a testing framework were you can't be sure of what got created or not.
Greg
Greg on 14 Feb 2018
I agree, quit and exit both seem pointless. Click the x in the corner - why in the world would you ever programmatically want to kill the MATLAB session?
Andrew Newell
Andrew Newell on 24 Jun 2011
Even when you're installing a new version?
Jan
Jan on 21 Feb 2011
It would be helpful, if a modification of the window icon will not conflicts with the license conditions.
When I open 120 Matlab figures, it can be helpful to group them optically in the popup-menu of the Windows-taskbar, e.g. by different colors in the icon.
Jan
Jan on 21 Feb 2011
Case-insensitive command recognition.
When I'm working on Linux, I have to consider the correct upper/lower case. The ability to call a command with a deviating case is a source of bugs and not a valuable freedom.
I appreciate, that case conflicts create a warning in modern Matlab versions.
Greg
Greg on 15 Feb 2018
@Steven: Thanks. I can't believe it was that long ago (I remember the time when it was a warning).