[DEPRECATED] What frustrates you about MATLAB?

Oliver Woodford on 16 Feb 2011
Latest activity Reply by DB on 13 Jun 2023

I love MATLAB. It is so quick and easy to write software to do what you want. It has excellent debugging and profiling tools. It is cross platform, making code easy to share (assuming the other people have forked out for the not-so-cheap license). It has interfaces to other software.
However, there are some things about it that irk me. I'd like to hear from other people what things annoy them about MATLAB.
---------------------------------
Because this thread has become so large it is slow to load and navigate. Please post new answers in the second thread.
---------------------------------
Rik
Rik on 10 Dec 2022
I was given to understand when the move feature was introduced that moving to a different thread would be possible in the future. I don't know the timeline for that feature or whether they're still working on it. It might come together with a different change I'm expecting to be done somewhere in the next 6 months.
Moving between threads will really help keeping threads like this clean, as I could move 110 answers to two different threads to get this one back to 50. It will take me an afternoon, but the end result would be navigateable threads.
DGM
DGM on 10 Dec 2022
Oh. I was afraid that's what happened.
:( seconded
Stephen23
Stephen23 on 10 Dec 2022
"Can't we just move new answers to the most-recent thread?"
That is what I just tried with the above comments, but it seems that moving only works within a thread :(
DGM
DGM on 10 Dec 2022
Can't we just move new answers to the most-recent thread? I'm reluctant to try it myself, since these extra-heavy pages almost never load correctly on my connection, and I've already had to deal with items which won't move or don't move completely after I touch them.
EDIT: I guess this "structs" thread is now in a pile of comments instead.
Rik
Rik on 10 Dec 2022
@Bruno Luong Unfortunately the only current way that is possible is by closing the thread, which has its own downsides. That is one of the reasons I have asked for a soft-lock option to be implemented.
I don't think reading the opening post is an unreasonable thing to expect, especially if you expect anyone to bother reading your comment.
Bruno Luong
Bruno Luong on 10 Dec 2022
"why did you ignore the comment at the top and post your answer in this thread?"
If you don't want people to post here then this thread should be locked. People just do search and they end up here, and no one bother to read the instruction before posting, they end up here alreadu frustrated (by MATLAB).
Rik
Rik on 10 Dec 2022
The 'problem' in this case is that x.a produces a comma separated list. It is equivalent to x(1).a,x(2).a,...,x(end).a. When you understand that, this behavior makes perfect sense.
And regarding jsondecode; the behavior is deterministic and documented. It depends on whether Matlab can tell the input structs would be the same. If they are, the result will be a struct array.
You can also follow it up with a function that converts a struct array to a cell array of structs if you prefer.
More importantly, why exactly is this being posted in this thread instead of the second thread? On mobile this page will not load properly anymore, and even on some computers it is getting harder. @Etienne Grossmann why did you ignore the comment at the top and post your answer in this thread?
Samuel Gray
Samuel Gray on 10 Dec 2022
I suppose this depends on what you mean by "frustration". I usually think of it as reward -effort. Now I can see where possibly someone might want to make an array of structures. A directory-search returns a structure, so if you were to dir of a tree, that would return an array of structures. That doesn't require any funky javish code. If you're going to down that rabbit-hole it's a matter of documentation as much as anything else, right? And I totally agree that when documentation is incomplete or just not there or obtuse, AND i REALLY NEED TO DO SOMETHING THAT RELIES HEAVILY ON THE DOCUMENTATION, that yes it can be frustrating. If I can't find an easier, better way to do it. I had a very bad experience with this using the Signal Communications toolbox to try to do tcp and udp data transfers in Win10. Turns out this is a long-standing problem. Because MS came out with an entirely new & different proprietary network stack which does not work with the Windows version of Matlab. It works fine with the Linux version. But the real solution is to just use the pcap stack. Or, you know, get a good book on winsock and have at it. The point is that you have to balance need and "available options" against difficulty, time and net frustration. It's not about getting X(:) done with toolset Y(:) it's about figuring out how to create and organize a custom toolset-documentation combination to solve an appropriate set of problems in an appropriate amount of time and effort. "Appropriate". Use it like play-dough. It's great. Solves every problem.
Walter Roberson
Walter Roberson on 10 Dec 2022
You could, of course, reduce it all to cells, like
x4 = {{3, 100}, {4, 200}};
whos x4
Name Size Bytes Class Attributes x4 1x2 656 cell
Besides the fact that this takes more memory than the struct array, you have the problem that you have to pass around a "key" everwhere in order to use this data. structs associated information with a name -- to use a field of a struct you do not need to know the relative position of the field within the struct, you only have to know the name of the field. Cell arrays on the other hand, you have to know which index is associated with each data item.
Walter Roberson
Walter Roberson on 10 Dec 2022
x1(1).a = 3; x1(1).b = 100;
x1(2).a = 4; x1(2).b = 200;
x2 = struct('a', {3, 4}, 'b', {100, 200});
x3 = {struct('a', 3, 'b', 100), struct('a', 4, 'b', 200)};
isequal(x1, x2)
ans = logical
1
whos x1 x2 x3
Name Size Bytes Class Attributes x1 1x2 576 struct x2 1x2 576 struct x3 1x2 912 cell
Notice that the cell version takes more memory. When you have a cell of scalar structs, then the name to offset information has to be repeated for each one of the entries, whereas for a struct array, the name to offset information is the same for each index.