Ideas
Follow


Paulo Silva

What is missing from MATLAB?

Paulo Silva on 14 Feb 2011 (Edited on 5 Mar 2024)
Latest activity Reply by Newthon on 14 Aug 2023

I'm curious, is there something you wish to do with MATLAB but you can't, maybe something you can do with other similar software but can't with MATLAB?
For new entries, please use the follow-up thread here. Please do not post new answers in this thread.
Newthon
Newthon on 14 Aug 2023
Compare sldd files and publish a HMTL report using Matlab script:
I can compare .slx, .m, etc. files using the visdiff function and publish a report using the publish function like this:
compare = visdiff('File1.slx', 'File1_changed.slx');
publish(compare, 'format', 'html');
But I can´t do the same with .sldd files:
compare = visdiff('File1.sldd', 'File1_changed.sldd');
publish(compare, 'format', 'html');
Error using visdiff
Unable to compare 'C:\basic\File1.sldd' and 'C:\basic\File1_changed.sldd' without opening the Comparison Tool.
Why if I can generate an HTML report using the Comparision Tool in the same way, both for .slx and .sldd files?
slevin Lee
slevin Lee on 31 Oct 2022
I want to use the SymbolicTransformer function of python GPlearn
Why does the paid matlab not have some functions on free python? I can't understand
cui,xingxing
cui,xingxing on 7 Feb 2021
How to visualize the changes in dlarray/weight distribution with histograms in deep learning?
Histogram displays how the trend of tensor (weight, bias, gradient, etc.) changes during the training process in the form of histogram. Developers can adjust the model structures accurately by having an in-depth understanding of the effect of each layer.
cui,xingxing
cui,xingxing on 2 Feb 2021
I very much hope that the official version will strengthen the readstruct function in the future! Lack of complete uniformity to support more format requirements.
Walter Roberson
Walter Roberson on 29 Jul 2020
Missing: ability to set multiple bits within the same word, by bit number.
Currently, if you try something like
bitset(A, [5 3])
then you get back a vector of values, setting each of the bits in turn, instead of setting all those bits within a single word.
You have to resort to things like
bitor(A, sum(bitset(0, [5 3])))
cui,xingxing
cui,xingxing on 24 Jul 2020
and so on....
The above are influential applications of deep learning in various aspects, but it is difficult to reproduce in matlab. Although Matlab2019b version supports automatic differentiation mechanism, it is still difficult to implement algorithms in matlab. The efficiency of the differentiation mechanism is not high, and many operators do not support it. I tried to implement the more famous yolov3/v4 algorithm with the latest MATLAB2020a version, but it is still not satisfactory
In summary, my personal suggestions are like my personal answer above, and I hope that future versions can improve a lot!
以上都为深度学习在各个方面有影响力的应用,但是在matlab中复现困难,虽然Matlab2019b版本支持自动微分机制,但仍然不易在matlab实现算法,微分机制效率不高,很多operators也不支持。。。
总之,我的个人建议就像上面的个人回答建议一样,我希望将来的版本可以有所改善!
cui,xingxing
cui,xingxing on 24 Jul 2020
Oh, good, thank you for your reminder, I thought I didn’t publish it yesterday!☺😀😀
Walter Roberson
Walter Roberson on 24 Jul 2020
It disappeared from the bottom of the list because it got voted for and moved upwards.
cui,xingxing
cui,xingxing on 23 Jul 2020
and so on....
The above are influential applications of deep learning in various aspects, but it is difficult to reproduce in matlab. Although Matlab2019b version supports automatic differentiation mechanism, it is still difficult to implement algorithms in matlab. The efficiency of the differentiation mechanism is not high, and many operators do not support it. I tried to implement the more famous yolov3/v4 algorithm with the latest MATLAB2020a version, but it is still not satisfactory
以上都为深度学习在各个方面有影响力的应用,但是在matlab中复现困难,虽然Matlab2019b版本支持自动微分机制,但仍然不易在matlab实现算法,微分机制效率不高,很多operators也不支持。。。
cui,xingxing
cui,xingxing on 24 Sep 2021
Thank you for your reply, I have been following the latest development progress of "deeplearning toolbox", although there are a lot of new features listed, but most of these are superficial improvements, the substance of the support “operator” is very limited, for the experienced in-depth researcher is still very insufficient.
Steven Lord
Steven Lord on 23 Sep 2021
I'm not familiar enough with Deep Learning Toolbox and the functionality you've requested to determine how much (if any) of what you've requested has been implemented, but the Deep Learning Toolbox Release Notes lists many items for each of the past couple releases. Perhaps you can scan through and determine which of your requests have been implemented.
Walter Roberson
Walter Roberson on 30 Jun 2020
Ability to use a multidimensional logical array to substitute for multiple dimensions while still specifying other dimensions.
For example if you build an ROI that is going to be 2d, and you cannot currently do things like
array(mask2d, :)
array(mask2d, :, :)
to talk about the rgb elements associated with the mask.
In the particular case of ROI mask you can repmat(mask, 1, 1, 3) but there are plausibly times where you might want to do something like
array(2, mask)
with you wanting to substitute a 2d logical array for the second and third dimension.
Chris Dean
Chris Dean on 15 Feb 2020
  1. Native support for custom keyboard shortcuts, i.e. let me point to a function to execute when a key-combo is pressed. Currently I can put them in the "Favorites" and add them to quick-access and order them for Alt+1, Alt+2, etc, which is alright, not great if you want more than 2 or 3. There is also theEditorMacro from File Exchange, which is good, but would be nice if it was baked-in to Matlab so I could more easily share helper functions with colleagues.
  2. Better git support. VS Code is light-years ahead here, for example.
  3. Extended syntax highlighting. Built-in keywords are highlighted, let's add a color for variables, functions calls, and class constructors/static methods. The example screenshots here are a nice example of how much more readable code is with functions highlighted.
  4. Bring the improvements of function parameter help text from live scripts to the regular .m files
Steven Lord
Steven Lord on 23 Sep 2021
In release R2021b the Editor now automatically displays contextual hints for arguments, property values, and syntaxes. See the Release Notes for more information. There are some additional editor related changes also listed in the Environment section of those Release Notes, just clear the search term "suggestions" to see them.
dpb
dpb on 15 Feb 2020
" Back in the 90's when I used the Brief programmer's editor,..."
Amen, brother! to all of the above. Anything based on the Windoes CUA is fatally broke before leaving the station.
Besides the features above, column cut/paste, bookmarks, etc., etc., ... the list is nearly endless besides the facility to customize at will what you didn't like or needed improved or simply just wanted to add. Theoretically one could do custom integration in VS editor but the level of complexity is so high as to make it essentially a fulltime occupation to be able to learn it well enough to do anything useful.
Simply even keystroke mapping is broke because you can't get away from the stinkin' context switch with Alt and Ctrl that aren't mappable so all of a sudden you're back at menu level instead of in the file edit context. Pitiful stuff! :(
And, unfortunately, the situation hasn't really improved significantly as far as the editing functionality itself; only the integration of debugging and the accroutrements of syntax coloring, etc., Not that those aren't significant and very useful in their own right and the coding hints are especially good for newbies (if they would only pay attention to them as we see here in Answers they generally don't, just as folks mostly don't read the documentation more than a cursory scan...).
I've retired from active consulting, but while still writing significant code, my general development pattern was to actually write the code using Brief or a workalike outside the ML environment and only if needed more than cursory test/debug, then and only then load into the integrated editor for that purpose to set breakpoints.
Image Analyst
Image Analyst on 15 Feb 2020
I very much agree with having easy keyboard macros. Back in the 90's when I used the Brief programmer's editor, and later Codewright, they were so SO much better than the current crappy Windows CUA editor that we're all stuck with now. For example to copy whatever line the cursor is on into the clipboard, you simply typed + on the numeric keypad, and to cut you simply typed - on the numeric keypad. No having to place the cursor to the left in the small Angstrom-wide space where the arrow reverses direction and then typing control C.
And if you want to record any number of keystrokes, you'd simple type the F5 key, then type your keys, then type F5 again to stop it. Then to redo those keystrokes, you'd simply place the cursor where you wanted to do them and type F7. Very easy and very efficient.
And with searching and replacing text, the Codewright search box had a "Once" button where you could just do the final replacement once, and it would stay there. Currently, it will move to the next location in the file which is likely miles away from where you were and now you have to find the left pointing arrow on the tool ribbon and click that to get back to where you wanted to stay.
Line-based programmers editors are so much better than character based editors like in WIndows, which is best for things like word processing documents, not line-based computer programs. I would really like it if we could replace the crummy editor in MATLAB with something like SlickEdit or similar. It would make me a lot more efficient. A long time ago I think I looked into it and it appeared you could but you lost the ability to do debugging, like setting breakpoints, stepping on lines of code, etc. You could only edit the text. Not sure if there's been any improvement to that. let me know if there has.
Rene M
Rene M on 6 Feb 2020
Being able to compile a desktop standalone app made in app designer that works on a 32 bit Windows.
Rik
Rik on 6 Feb 2020
Although I agree with your conclusion, I do want to comment on the level of obsolescence of 32 bit.
In early 2016 I bought a 2-in-1 and didn't pay enough attention. When trying to update to Win10x64 I discovered that the CPU itself was 32 bit, and the 64 bit option wasn't the default. This was from a reputable brand. So it is not that obsolete. I would even suggest computers like that are a prime target for cross-compilation, because small apps will run fine, but complex calculations would be an issue.
Walter Roberson
Walter Roberson on 6 Feb 2020
This will never be possible. 32 bit support is gone and it will never return: it presented too many limitations. The current minimum memory for MATLAB is the same as the maximum memory for 32 bit.
I did some checking a couple of years ago. I could only find one Intel 32 bit x86 CPU that had been manufactured in the previous decade, and manufacturing of it had stopped several years before I checked. I checked the major laptop and notebook manufacturers and could only find one Intel or AMD based notebook that was manufactured with that 32 bit CPU, with the manufacturer having switched to x64 completely after about 18 months.
My mother's 15+ year old system has an x64 and it was always a low budget system: by 15 years ago it was no longer economical to put x86 cpus into low budget computers.
If your hardware is x86 then you are talking about the kind of computers that charities will no longer accept to send to needy people, because the systems are so obsolete. You can get better systems literally given away on Craigslist or equivalent.
I would recommend against Mathworks putting any effort into this idea.
cui,xingxing
cui,xingxing on 16 Aug 2019
DeepNework object detection: https://github.com/weiliu89/caffe/tree/ssd ,in this repository, I do't know how to design my ssd netwok in matlab, only fast/faster RCNN, yolov2 algorithm can support, i can't free design( ▼-▼ )
DeepNework face and key point detection:https://github.com/kpzhang93/MTCNN_face_detection_alignment
cui,xingxing
cui,xingxing on 6 Feb 2020
Thank you for your prompt reply!@Justin Pinkney
Justin Pinkney
Justin Pinkney on 31 Jan 2020
There is a MATLAB version of MTCNN face detection and alginment here: https://github.com/matlab-deep-learning/mtcnn-face-detection
Christopher Greulich
Christopher Greulich on 13 May 2019
Better programatic suport for formating and manuplating live scripts, ideally full markup support in the live script enviroment.
Live scripts have the ability to use markup like commands to autoformat text (https://www.mathworks.com/help/matlab/matlab_prog/format-live-scripts.html). Imbracing markup a little more and allowing the live editor to freely switch between formated and markup views.
Allow formated text to be procedurally generated by the program. I'm conducting various trials or expirments in a live script and keeping track of the trial number with a variable. Allowing that variable to be inserted as a header so it is tracked in the table of contents would save time formating the report and allow more time for experimentation.
Christopher Greulich
Christopher Greulich on 13 May 2019
The first link was not the one I was thinking it was but still kinda valid because it speaks to the larger part. The one I was writing about was https://www.mathworks.com/matlabcentral/answers/458252-how-to-get-the-file-path-inside-a-script-function-or-model where there isn't a way of getting the currenlty running file name while in the live editor.
There is alot of access to objects (gco), axes (gca), and figures (gcf), manupilating them and then saving them with saveas(). There isn't a comparable gcfile (mfilename or dbstacks() doesn't work) and the saveas relies on matlab.internal.richeditor.openAndConvert which, while it works, relies on internal matlab calls which broke with richeditor to liveeditor refactoring and isn't as polished as saveas().
I'm just thinking if live scripts want to be seen as dynamic all ecompassing multimedia content it would be good to get alot of access raw access to easily manipulate it. I sometimes process dozens of csv's of data with a generic script than export results to html. After looking at the html I'll than conduct additional analysis on certain data sets. I'll rather programatically create a dozen different mlx files run them with a batch script than be able to edit the individual mlx file when I do the additional analysis.
Walter Roberson
Walter Roberson on 13 May 2019
That first link only has to do with publishing live scripts, so it is not obvious to me that it is the link you wanted?
There is a need to permit live scripts to output tex / latex to be displayed, without having to text() that into place on an image.
madhan ravi
madhan ravi on 8 Feb 2019
It would be nice and make life a lot easier if bsxfun() has mtimes functionality or if 3D matrices can be matrix multiplied with just an (asterisk *) in later versions . While trying to matrix multiply between two 3D matrices it's quite frustrating.
Steven Lord
Steven Lord on 17 Sep 2020
See the pagemtimes function introduced in release R2020b.
Walter Roberson
Walter Roberson on 8 Feb 2019
There is a File Exchange contribution for that; my memory says it is from Jan.
On GPU, pagefun() can do that.
Will
Will on 10 Jan 2019
Syntax highlighting that picks up fields of structures, not just the structure names themselves.
I want to know where I use a given field, and to be able to universally alter all uses if I rename it, as you can with variable names, structure names, etc.
Lucademicus
Lucademicus on 8 Jan 2020
I guess Rik's comment is offtopic, I agree with Will.
Automatically highlighting a selected field of a struct (or property of an object) would be very helpfull. I'm using VS Code, which is a bit better because it highlights other words similar to the selected field.
Steven Lord
Steven Lord on 10 Jan 2019
Code Analyzer warning suppression. See the "Adjust Code Analyzer Message Indicators and Messages" section on this documentation page for more information.
dpb
dpb on 10 Jan 2019
"Before I learned about the %#ok..."
OK, that's greek to me...???
Rik
Rik on 10 Jan 2019
Before I learned about the %#ok I used this as a feature to hide some warnings. In hindsight a terrible idea.
Kevin Chng
Kevin Chng on 10 Dec 2018
Currently, in MATLAB live script (up to version 2018b), it don't have features to show or hide the code section. Therefore, we need to use workaround solution (https://www.mathworks.com/matlabcentral/answers/393021-how-to-fold-up-code-in-live-script) , hopefully, next release will include this feature in live script.
Adam
Adam on 8 Oct 2018
As a regular user of object oriented programming one of the things I miss most from C++ (where I started) is the ability to pass handle-derived class objects around using a const property. I use handle-derived classes a lot (~95% of my classes) and their ability to pass by reference is very nice, but having no control over whether they can be edited or not is frustrating.
A colleague of mine was once querying how something could be changed in a class I had written because it had immutable set access. So I had to explain that because it had public get access any code could quite happily get hold of the object and make changes to it, the only thing immutable means is that a whole new object itself cannot be set.
I suspect wishing for this is fighting against the type of language Matlab is and other scripting-based languages maybe also don't offer constness (and even in C++ using things like boost shared pointers can have the same effect).
Jeff Miller
Jeff Miller on 8 Oct 2018
The editor tab has buttons to comment out the selected lines and to remove comments from the selected lines. In addition, it would be nice to have a button to toggle the comment status of all selected lines--that is, make the highlighted regular lines into comments and make the highlighted comments into regular lines. I would gladly sacrifice the comment wrap button (which I never use) for such a toggle option, if screen real estate is an issue.
Walter Roberson
Walter Roberson on 8 Oct 2018
I use the comment wrap. I never use automatic code wrap but I do reformat comments.
Rik
Rik on 8 Oct 2018
Especially during debugging/writing new code this would be useful to be able to quickly switch between two code situations.
If we're changing the way commenting works: it would be nice if it doesn't add the comments in the beginning of the line, but at the start of the code, so the alignment doesn't get broken if you comment things in places like a loop or an if block.
dpb
dpb on 6 Oct 2018
Neither textscan nor readtable can handle 'X' format string; whassup w/ that?
Why are hex data presumed to not be in text file with other data such as date/time strings or in files for which one or the other is the obvious higher level tool?
madhan ravi
madhan ravi on 25 Aug 2018
Is it possible to have the answer in latex form by default in command window?
The equations would be much more readable and understandable.
It could save lots of time , for instance in mupad by default the results are in latex form.
Steven Lord
Steven Lord on 21 Mar 2019
It's not specifically LaTeX format, but you can use symbolic computations in the Live Editor and have them displayed in a format more like what you'd see in a textbook than the plain text format in which they're displayed in the Command Window. Run the first two commands from this example in the Command Window and compare it to the results on that page (which is how it's displayed in the Live Editor.)
If you want to insert an equation as text, the Insert tab on the Live Editor's toolstrip includes a button "Equation" that will let you enter an equation either using an equation editor or by typing / copying LaTeX code.
Walter Roberson
Walter Roberson on 26 Aug 2018
No, it cannot be. Latex is a terrible format for mechanical manipulation. People use text processing to manipulate the character representation of formulas.
madhan ravi
madhan ravi on 25 Aug 2018
yes sir what I mean is the results obtained from the calculations can't it be in the latex form by default?
Walter Roberson
Walter Roberson on 25 Aug 2018
Livescript formats equations.
mupad() notebooks are being removed.
dpb
dpb on 4 Feb 2018
TABLE type needs display format by variable similar to the DATETIME object. Having to set global application format is a nuke for a fly-swatter. Sample--
>> t(:,[1 2 6 7])
ans =
Acct Pool Corpus Value
______ ____ __________ __________
S62671 4 2e+05 2.0369e+05
B62630 7 1.0545e+06 1.0561e+06
C62730 7 5.292e+05 5.3007e+05
C62731 7 3.116e+05 3.1202e+05
S62668 8 79527 94990
>> format bank >> t(:,[1 2 6 7])
ans =
Acct Pool Corpus Value
______ ____ __________ __________
S62671 4.00 200000.00 203694.22
B62630 7.00 1054497.48 1056134.46
C62730 7.00 529200.84 530067.94
C62731 7.00 311601.19 312017.40
S62668 8.00 79526.58 94989.65
>>
Default of format short mixes up integer values and non- so nothing aligns well plus insufficient range; since are accounting figures format bank fixes it for the two columns that are dollars/cents, but turns the integer Pool number into float that's ugly plus everything at the command line is also in bank format which is inconvenient for other uses as well.
dpb
dpb on 4 Feb 2018
I agree if one were to make it totally generic it could become complex; I'd be satisfied if simply could set numeric variables format by variable. While different columns in a numeric array variable can be different, having one format spec for the array would be no different than what exists now from that standpoint but quite a lot more granularity than is presently available, "built-in".
While it's true that the table object could be quite handy for display-only purposes, it's just a missing convenience in the implementation while even writing code or using the tool for interactive debugging and/or exploratory data analysis (the latter being what was doing when got annoyed; still working on the college foundation data-keeping mishmash of Excel spreadsheets and have exported them to Matlab tables for some "smooshing" and was trying to ensure had the right numbers. Then I needed to do some other calculations and BANK was totally unsuited for those while still not done otherwise).
Under the guise of "the object is only there for the data storage" there's no reason time values are displayed in other than the internal storage representation, either. :)
BTW, I don't disagree with the concept of the further expansion, either; Matlab is quite short on such amenities, overall...I'd just like the "one small step" first. :)
ADDENDUM For the given example I can work around "the uglies" by converting the pool numbers to categorical; I deliberately used them as numeric to illustrate an example why it would be nice to have the facility; not all integer-valued variables would want to be turned into categorical.
Walter Roberson
Walter Roberson on 4 Feb 2018
A fair number of people confuse table objects (collections of related variables, sort of like a database) with tables for display purposes. Mathworks essentially did not try to create tables for display purposes.
If tables are to be improved for display purposes, one suggestion I would have would be to have an option for displaying the variable description property under the variable names, along with an option to not display the variable names at all. The variable units should also be displayable. Probably the units should be after the description.
If supplying a format specifier for variables is permitted, then the specifier would have to take into account that individual variables can have multiple columns, and that there could be potentially long character vectors or string objects. Dealing with wide data but limited space might call for implementing some kind of "flow" properties... which would be helped by providing a hyphenation routine...
Stephen23
Stephen23 on 9 Jan 2018
"... horizontal placement. Why not 'top, middle, and bottom'?"
Because top, middle, and bottom are vertical alignment, not horizontal alignment.
"Should be included in the help file associated with 'text'?"
In the help page: "For a full list, see Text Properties", which takes you to the page describing all of properties of the text object. These are listed in their own dedicated help page (just like with every other graphics object).
dpb
dpb on 9 Jan 2018
Perhaps more enhancement than missing, but...
A search function that is tolerant of variable data types in the target object. Example is a cell array of mixed text/numeric types that need to find a given text within. At present (afaik, anyway) there is no function that will search the cell array ignoring the cells containing other than text content. If one constrains the search to the locations with just text by logical addressing or such, then the result is consistent within that subset but relating that set of locations back to the location in the original is not necessarily trivial.
Jeff Owen
Jeff Owen on 2 Jan 2018
Oops, turns out it is there. I just tried 'VerticalAlignment','top' and it works. Should be included in the help file associated with 'text'?
Jeff Owen
Jeff Owen on 2 Jan 2018
When inserting text into a figure, Matlab gives 'left, center, or right' as options for horizontal placement. Why not 'top, middle, and bottom'? I have a vector of text strings, the top of which I want to position at the top of the graph, but the placement is automatically 'middle'. The length of the vector changes from time to time. It would be clumsy to have to re-calculate the placement coordinates based on the length of the vector. Easier if I could just say 'top'.
dpb
dpb on 1 Dec 2017
textscan has only limited subset of the allowable formatting strings -- specifically, '%X' for hex data is missing. Why? Are we supposed to not ever have hex data for input? Why can't/doesn't it handle all available forms as are provided in the underlying C i/o library with fscanf and friends?
dpb
dpb on 1 Oct 2017
Quite a lot on the graphics side...just a couple to start reminded by the Answer I just gave (for about the umpteenth time) on how to label grouped bar graph--
  1. bar graph interface/modifications terribly difficult; labeling the bars in a grouped bar plot one of the most egregious oversights.
  2. no builtin hatching patterns yet after 30 years...whassup w/ that; had 'em w/ Calcomp plotters in the '60s...
  3. don't have consistent decimal format labelling by default on axes -- butt ugly; at least the numeric format (finally!!!) makes it a little easier but why have to fixup such trivial stuff manually?
I know there are quite a number of other things that just make me cringe or my teeth itch but I'm not thinking of them at the moment -- those two came now because of the question...
James Ryan
James Ryan on 1 Oct 2017
I'd like to be able to get pricing information for a proposal without waiting for a sales contact. It is frustrating that most of the information is online, but key parts are withheld.
I'm particularly concerned with Matlab coder. I have a student copy I paid either $10 or $29 for. Home users can't get it all, I hear. An academic user (my advisor) pays more for MATLAB, but Coder isn't listed as an option. Is that because it's included, or because it's not available, or because there's some special process for getting it?
Why so complicated? I just want my advisor to be able to compile a key part of the models I produce so they run at comparable speeds. She can't use my mex files because we are on different operating systems.
Walter Roberson
Walter Roberson on 1 Oct 2017
University licensing is especially complicated due to multi-institution deals and the several different license types available for academic use.
Generally speaking:
  • for countries where Mathworks permits students to use the online store, any product not listed in the online store for Student licenses, is not available for student licenses
  • for countries where Mathworks permits academic or commercial clients to use the online store, any product not listed in the online store is expensive enough that it would be more expensive than the typical credit card limit, requiring a different purchase mechanism such as a Purchase Order.
I do not recall the approximate price for MATLAB Coder for Academic use; if I ever saw it, it would have been at least 6 years ago.
The MATLAB Coder license for commercial use was on the order of $US8500 at one point.
"She can't use my mex files because we are on different operating systems."
If you used MATLAB Coder to create mex C/C++ source files, then those can be compiled on any operating system supported by MATLAB.
Royi Avital
Royi Avital on 26 Aug 2017
What I miss the most is better forum for the community.
We need Math Equation support through MathJaX (Like in StackExchange communities).
We need better editor for answers.
We just need a StackExchange based forum for MATLAB with all the features.
Something like:
Cedric
Cedric on 12 Sep 2017
While a disagree about many points and about the form of the post, I do agree about MathJaX. It wouldn't be a big deal to support it (in that it doesn't conflict with what is currently implemented as far as I can say [using it in my own projects]), and it could bring quite a bit for discussing the theory behind what we implement numerically.
Walter Roberson
Walter Roberson on 26 Aug 2017
In the rare occasion that I need to latex something into place, I google "render latex" and pull up a site such as http://quicklatex.com/, put in the code, get out a URL for an image.
Stephen23
Stephen23 on 26 Aug 2017
@Royi Avital: to be honest I have found that most of the MATLAB advice on StackExchange is very outdated, is of questionable quality, and is sometimes downright incorrect. My favorite example is the authoritatively written answer here:
which shows a total lack of knowledge about MATLAB by confusing the colormap and the axes line ColorOrder. The fact that the answer is incorrect, thoroughly misleading, and totally useless for understanding MATLAB yet has received 18 votes and not a single comment correcting its information was one of the main motivations for me to avoid StackExchange: it seems to be mostly populated by teenagers who want a quick fix and to never bother to read the documentation.
Jan
Jan on 26 Aug 2017
With all respect, I do not like the are51 site. When I follow your link, I see a page with a list of "example question", but none of them is a link and I cannot click on anything meaningful. I do not get the faintest idea about what information this page offers. I guessed, that I have to create an account at first, but when I click on the page for creating an account, my browser warns me for a cross site scripting attack.
In my opinion the posted link is completely useless or junk and in consequence I do not understand, what you are asking for or suggesting.
I do not miss the support for equations yet, because posting screenshots of the LaTeX output or pseudo-code is sufficient usually.
Folkert Bleichrodt
Folkert Bleichrodt on 27 Jul 2017
I would like to have the ability to overload subsref and subsasgn separately for . [] () and {} separately. For example: subsref_square_bracket, subsref_dot, etc.
Now when you overload subsref for an object in order to use '()' on it, then you can't access functions using the dot notation (at least not without substantial effort).
Steven Lord
Steven Lord on 23 Sep 2021
Release R2021b introduces three subclasses from which your class can inherit to control whether the class customizes parentheses indexing, dot indexing, and/or brace indexing. This way you could inherit from (for example) matlab.mixin.indexing.RedefinesDot and implement its Abstract methods to control how myobject.myproperty works without affecting parentheses indexing.
Walter Roberson
Walter Roberson on 22 Feb 2017
As I work with objects, especially graphics objects, I find that more and more often I wish there were some easy way to sort the lines of an output, or to grep the output.
For example,
[~, h] = contourf(rand(20,30));
struct(h)
now try to find the Alpha information.
If there were (unix command line style)
struct(h) | sort
or
struct(h) | grep -i alpha
then this would be easier.
This syntax itself of course would not work as | and || are already used in MATLAB. I recall seeing at least one programming language in which pipe was indicated by # which is a currently unused operator
struct(h) # sort
In at least some cases it would be possible to write a user function, something like
function sortlines(values)
if iscell(values) && all( cellfun(@ischar, values) )
as_cellstr = values;
elseif ~ischar(values)
as_cellstr = regexp( Capture(values), '\r?\n', 'split');
else
as_cellstr = cellstr(values);
end
[~, sortidx] = sort( strtrim(as_cellstr) );
fprintf('%s\n', as_cellstr{sortidx});
end
function S = Capture(values) %#ok<INUSD>
%magic reference to parameter name because evalc needs a string
S = evalc('disp(values)');
end
and then sortlines(struct(h)) works usefully.
Walter Roberson
Walter Roberson on 27 Jul 2017
"Converting objects into a struct is generally not recommended"
It is not uncommon for me to be poking into the internal details. People ask if something can be done, and with the complexities of HG2 I sometimes need to dig in to the non-public properties.
I also need this to understand the behaviour of some objects. For example a couple of months ago someone was having difficulty accessing a public property, and when I dug into the matter it turned out that the property was a dependent property and the real information was derived from other properties.
When someone asked recently whether biograph graph plots could use single non-arrowed arcs for bidirectional connections, it was a question that could only be answered by looking at the internal data structure (and do some digging in the code) to see that No, it was not possible.
Part of this could be phrased as a disagreement with which properties should be public, as some of the non-public properties turn out to be useful for programmers.
But then part of it is driven by the fact that I wrote a program to cross-check .fig files for validity, and I don't just do a surface-level check....
Walter Roberson
Walter Roberson on 27 Jul 2017
I improved the code a bit; my current version is:
function output = sortlines(values)
if iscell(values) && all( cellfun(@ischar, values) )
as_cellstr = values;
else
if ~ischar(values)
if isobject(values)
old_warning_state = warning('off', 'MATLAB:structOnObject');
values = struct(values);
warning(old_warning_state);
end
values = Capture(values);
end
as_cellstr = regexp( values, '\r?\n', 'split');
end
[~, sortidx] = sort( strtrim(as_cellstr) );
if nargout == 0
fprintf('%s\n', as_cellstr{sortidx});
else
output = as_cellstr(sortidx);
end
end
function S = Capture(values) %#ok<INUSD>
%magic reference to parameter name because evalc needs a string
S = evalc('disp(values)');
end
Steven Lord
Steven Lord on 9 Mar 2017
Converting objects into a struct is generally not recommended (and in fact issues a warning.) For graphics objects, I'd call get with just the object as input to get a struct with the public properties. But to the side question of sorting fields in a struct array, the orderfields function has been part of MATLAB for quite a while (at least release R13SP2 in 2003, according to the archived documentation on the Support website.)
dpb
dpb on 12 Jan 2017
Generic search of cell arrays for values where cell contains mixture of character and numeric data.
Example
>> whos facilities
Name Size Bytes Class Attributes
facilities 10295x97 68335626 cell
>> facilities(1:10,[1 4])
ans =
'U.S. Department of Energy, The Energy I...' ' '
'EIA-923 Monthly Generation and Fuel Con...' ' '
'Sources: EIA-923 and EIA-860 Reports' ' '
' ' ' '
' ' ' '
'Plant Id' 'Plant Name'
[ 2] 'Bankhead Dam'
[ 3] 'Barry'
[ 3] 'Barry'
[ 3] 'Barry'
>>
It'd be much more convenient to be able to just search for a given plant ID number (numeric) or name (alphanumeric) but no can do that I'm aware of w/o separating out the disparate types and doing so then loses the absolute reference as results are returned relative to the position in the subset, not the actual array itself.
This particular example is complicated owing to EIA having changed format and header row and columns aren't consistent for all years of downloads hence the file has to be parsed from the raw data to automagically return specific data across multiple years plus number of reporting units varies from year to year.
It's also confounded by the fact that returning the numeric and text data arrays is also not self-consistent--for the same file the result of doing that is
>> whos dat txt raw
Name Size Bytes Class Attributes
dat 10461x97 8117736 double
raw 14000x97 92673516 cell
txt 10467x97 62650656 cell
>>
I'm not sure at this point where the disparity of 6 between dat and txt arises but it's very worrisome that wouldn't be certain were actually getting the right data from one searching on the other for the location.
NB: The difference between the 1400 above vis a vis the earlier 10295 is owing to having manually truncated dummy entries introduced at the end of the database by EIA while futzing around trying to find a good search algorithm that worked across the full range of available files.
Steven Lord
Steven Lord on 13 Sep 2018

If your data is tabular in nature, store it in a table (which can handle mixed numeric and non-numeric variables) and use the string selection capabilities to select rows and/or variables from the table. Using a subset of the example from the documentation page for table:

>> load patients
>> patients = table(LastName,Gender,Age,Height,Weight);
>> head(patients)

How many patients have a last name that starts with the letter J?

>> patients(startsWith(patients.LastName, 'J'), :)

Looks like 5 of them. Three of them are under the age of 40.

>> patients(startsWith(patients.LastName, 'J') & patients.Age < 40, :)
dpb
dpb on 13 Jan 2017
OK, for now looks like about best can do for present purposes is use strncmpi and restrict searching to the string values. I hadn't recognized that the strcmp family were more robust to inputs than the traditional strfind and friends. Using strncmpi I can work around the name normalization issue and go back to the raw array such that at least then the header line offset issues go away.
I'll keep puzzling over how to mix the numeric in; at some point that will likely be significant as well altho can live without for the moment.
Thanks for the pointer, Walter, I had just assumed they would also croak on the non-string cells...
dpb
dpb on 13 Jan 2017
@Sean, Thanks for suggestion; unfortunately I don't have the requisite hardware/OS for the versions past 32-bit (R2015a, mayhaps?). I'm experimenting with R2014b at the moment; it runs albeit a little slow but for "toy" datasets and no clients except my own interest it's bearable, at least so far...
But, the crux of the complaint is that cell arrays are for and do hold disparate data types by their very nature and the mix of those is not an error or even mistake; it's the nature of the beast.
As such, the basic complaint is that there aren't functions provided that inherently deal with that diversity; searching within the cell array across those different types is a useful and oft-needed (I can't imagine I'm the only person to do similar data consolidation such as this example from data sources that unfortunately weren't designed for it).
dpb
dpb on 13 Jan 2017
Ah--you've taken it inline, instead.
isequal does accept any cell content; that's good but now it's also an exact match which in the given application is a problem because EIA also didn't normalize the plant names--"Gray County" sometimes has "Wind Energy" appended and sometimes doesn't; hence the regexp in the above function. It, of course, can't handle the non-text fields in the raw cell array which is what exasperated me and prompted the complaint.
Given there's also not a 1:1 correspondence to the offset to the header row in the files between the data and text arrays--investigation last night on that disparity reveals the number and placement of the blank lines at the beginning of the file and whether there is/isn't one (or more) after the header row before the actual data begins affects that offset so as was afraid it's not a reliable indicator.
I still don't see a good generic solution altho I've got a script functioning correctly for the specific files to date it does have some kludgy workarounds internally.
Sean de Wolski
Sean de Wolski on 13 Jan 2017
You might want to look into the string capabilities in >=R2016b. You won't be able to store numeric values as numbers, but scanning, finding, and doing other text operations is much easier.
Walter Roberson
Walter Roberson on 12 Jan 2017
cellfun(@(C) isequal(C,facility), facilities(:,4))
You can use strcmp() or strcmpi() instead of isequal()
dpb
dpb on 12 Jan 2017
Sorry, Walter? I'm not seeing a syntax for
facility='Gray County'; % a specific plant of interest
ix=fnGenSrch(facilities(:,4),facility);
I keep running into need for the second argument to be another cell array the size of the first. I'm sure I'm now where I simply can't see forest for trees. Bestest I've come up with is one for strings only that looks like
>> fnSrchi
fnSrchi =
@(ary,s)find(~cellfun(@isempty,regexpi(ary,s)))
>>
but to use this requires separating out the types or doing character substitution for non-character cells before the search or other klunky workarounds.
Walter Roberson
Walter Roberson on 12 Jan 2017
cellfun with isequal
Elias Gule
Elias Gule on 29 Nov 2016
The ability to
  • Define the main class and inner classes in one single m-file.
  • Ternary operator.
  • Matrix-unpacking such that:
[A,B,C,D] = unpack(Matrix);
Assigns the first column of Matrix to A, the second column to B, the third column to C and the remaining columns to D. In the case where Matrix has fewer columns than the number of the required output variables; those variables whose indices are larger than the last column index of the Matrix will be assigned an empty matrix.
Walter Roberson
Walter Roberson on 29 Nov 2016
function varargout = unpack(Matrix);
t = mat2cell(Matrix, size(Matrix,1), ones(1,size(Matrix,2)));
if size(Matrix,2) < nargout
t(nargout+1:end) = [];
end
varargout = t;
Sean
Sean on 28 Nov 2016
The ability to detect the end of file condition (and stop output) when using the 'from-file' block in Simulink. This would allow the user to sequentially use input data files (especially useful for calibration data).
dpb
dpb on 11 Aug 2016
IA's recent comment on axes and a small farm task to solve for boundaries of a field location to locate a line such that the subsequent area along a non-straight waterway boundary contained a fixed number of acres reminded me of
Predefined hatching patterns patterns for surfaces and syntax to set them and their properties. While there are some FEx submissions, all I've tried have various warts and/or bugs and are version-dependent.
We were able to do this with CalComp graphics in the early to mid-60s on mainframes and the HP plotters and TMW can't do it in Matlab after 20 yr??? Wassup w/ that!!!???
Image Analyst
Image Analyst on 10 Aug 2016
The "axis" command/function should allow the ability to put tick labels on all tick marks. For example if you do "axis on" it will put tick marks on all 4 sides of a 2-D axis box, however the tick labels are only on the left and bottom sides. I'd like to be able to specify that tick labels (the numbers) appear on any of the sides, for example, all four sides.
Osnat Magen
Osnat Magen on 30 Jun 2016
Is this thread still relevant? I hope so.
I'm looking for the option to use a chosen 'colormap' for 1D plot. In other words - change 'ColorOrder' in to a given set of colors, without the need to choose and define the specific colors myself. MATLAB has such lovely colormaps, but I didn't find how to use them when plotting few line plots (either using 'plot' or 'semilogy' on the same figure).
Ideally - I would like to choose a colormap, and to choose the amount of colors I wish to have in my 'ColorOrder' list, and let MATLAB create the requested list. I think it shouldn't be complicated.
I'm attaching an image I've just created using several 'semilogy'. I think it help explaining my need.
I was going through your help, and looking for the answer online. Did I miss something? Regards.
Steven Lord
Steven Lord on 30 Jun 2016
Most if not all of the colormap functions accept an input argument indicating the number of colors to select. Since this weekend is Independency Day weekend in the United States, I'll show this using the flag colormap.
h = flag(9);
ax = axes('ColorOrder', h, 'Color', 'y'); % So you can see the white lines
hold on
p = plot(ax, magic(13), 'LineWidth', 3);
Compare this with:
figure;
ax = axes('Color', 'y');
hold on
p = plot(ax, magic(13), 'LineWidth', 3);
Alternately if you want to select only a few of the colors and let MATLAB determine the rest, the colormapeditor interface may be of interest. You can start off by selecting the 'white' colormap (sets all the rows in the colormap to white) and then set the "given" colors, letting MATLAB decide what to do between the specified colors.
Brian
Brian on 22 Feb 2016
Two things for tables:
  1. Item one: A function that tests whether a string names a variable in a table: isVariable( mytable, 'height')
  2. Item two: A plotting routine that handles tables. For example, a function that takes a table and then a "formula" (as with fitlm). For example:
plot(mytable, 'weight ~ height') % would plot one variable vs. another
plot(mytable, 'weight + height ~ age') % would plot two variables vs. a third on one axes.
Steven Lord
Steven Lord on 23 Sep 2021
In release R2021b certain plotting functions can accept table arrays directly and use the table variable names in axis labels and the legend. See the Release Notes for more information and a list of functions that can accept tables directly.
Steven Lord
Steven Lord on 13 Sep 2018

Both heatmap (introduced in release R2017a) and stackedplot (introduced in release R2018b) support visualizing data from table arrays. If there's a different type of plot that you would like to be able to create from a table, please send information about your use case to Technical Support so they can enter it into the enhancement database.

Walter Roberson
Walter Roberson on 22 Feb 2016
isVariable = @(Table, field) ismember(field, Table.Properties.VariableNames);
Martin H. Trauth
Martin H. Trauth on 2 Feb 2016
What's missing a CMYK Europe color profile for EPS files. While working on a textbook I really missed this, as all the colors where in the US color profile and I had to convert them with a different software before editing the postscript files from MATLAB.
timo
timo on 20 Oct 2015
The list datatype... Cmoon FFS this is in the 30 y old languages as standard.... Ex python:
x=[1,2,3,4]
x.append('s')
x
Out[4]: [1, 2, 3, 4, 's']
x.insert(0,'first')
x
Out[6]: ['first', 1, 2, 3, 4, 's']
Walter Roberson
Walter Roberson on 27 Jul 2017
java.lang.list can help.
Star Strider
Star Strider on 20 Oct 2015
ashish ahir
ashish ahir on 1 Jul 2015
A quick reply mechanism in matlab answer forum.
Steven Lord
Steven Lord on 1 Jul 2016
If you need a quick answer to a question and are under maintenance, calling your local office's Technical Support phone number (which you should be able to find using the Contact Us link in the upper-right corner of this page) is one potential option.
Walter Roberson
Walter Roberson on 30 Jun 2016
I am not sure this is a good idea. In my experience, many students want answers "now" and so would use a priority request routinely if it were available; it is not uncommon for those students to not revisit the forum for anywhere from 6 to 22 hours (and so demonstrating that their need was not priority after all.)
I would also point out that "quick reply" requires that interested volunteers be available within the target time window. The active volunteers are often busy. I already put in many more hours of volunteering than is healthy for me. I tend to skip answering the questions that ask for quick replies, because it stresses me out too much. I keep my balance by walking away from the computer whenever I want to or need to, which is acceptable for non-priority questions but not for priority questions. I cannot make the commitment to answer priority questions in any particular time frame, so I do not start answering them.
Walter Roberson
Walter Roberson on 1 Jul 2015
(based upon other postings, the above comment is discussing how long it can take to get answers on some topics.)
Petros Bogiatzis
Petros Bogiatzis on 15 Oct 2014
Single precision sparse matrices would be nice.
Chad Greene
Chad Greene on 28 May 2014
I'd like a good way to stop computation when I realize I've accidentally given Matlab an impossibly large problem. Ctrl+C only works when it wants to, and Force Quit is a pretty lousy solution.
Walter Roberson
Walter Roberson on 30 Jun 2016
In R2016a, there is a Pause button in the editor. However, it is very likely that it will not be able to pause in the middle a call to LAPACK or the like.
Steven Lord
Steven Lord on 30 Jun 2016
In release R2015a we introduced an array size limit preference that will cause MATLAB to throw an error if you try to create an extremely large array. See the description of this preference in the last row of the Workspace Preferences table on this documentation page.
Cedric
Cedric on 28 May 2014
It often happens when swapping occurs, because it isn't a faulty behavior in itself (yet, it is infinitely long). For this reason, I am often setting a watch dog on MATLAB with Process Lasso. You can find the reference in e.g. this thread.
Bjorn Gustavsson
Bjorn Gustavsson on 28 Feb 2014
To simplify the syntax by at first also allowing " as a string delimiter:
qwe = "This would be a good idea"
The double duty and hard labour of ' is an awkward and uggly feature in matlab. This apparently works in Octave, Mathworks haven't been too shy about introducing new and remove old syntaxes (e.g. the scattered data sampling.) and they should easily make a tool helping with modification of old code. This would help a lot in cases where strings has to be constructed with transpose operations in for example callbacks.
Steven Lord
Steven Lord on 13 Sep 2018

fprintf can accept string inputs in release R2018a.

>> version
ans =
    '9.4.0.857798 (R2018a) Update 2'
>> fprintf("Hello %s\n", "dpb")
Hello dpb

In Release R2018b you can "Specify text as string arrays where you previously specified text as character vectors or cell arrays of character vectors."

dpb
dpb on 3 Feb 2018
At this point there are no direct output routines as yet, though. The best there is is an intermediary step through compose to get character or cellstr array which none of the formatted output routines are aware of other than writetable which is useful for its purpose but not general.
Steven Lord
Steven Lord on 9 Mar 2017
You can now create string arrays using double quotes in release R2017a.
str = "Hello, World"
Walter Roberson
Walter Roberson on 30 Jun 2016
(This has not been implemented yet, as of R2016a)
dpb
dpb on 28 Feb 2014
Perhaps the immediate solution/workaround is the use of the transpose functional form in those cases (altho in general I don't disagree w/ the wish)?
Marco
Marco on 27 Feb 2014
I would like to see a more helpful editor, an editor which can (activated as a preference option) tell me if any of my own variable names or function names or m-file names, etc., is already in use by some other original THE MATHWORKS stuff. Let´s say, I am using the variable "i" in my script. But I am not aware, that "i" and "j" are already in use by MATLAB for somehting regarding complex numbers. Or let´s say, I am using a function which I name "move". But I am not aware that a function with such name already exists in MATLAB and I therfore without knowing might produce problems which I do not foresee. Let´s say, I am today using a certain function name, but tomorrow I will purchase a toolbox which is already occupying this name...
It is just not a good solution that I have to check each of my names in use with the "which" command first, in order to avoid such conflicts. The editor should be able to do this for me in the background automatically, especially that the editor could know about names in original The Mathworks toolboxes, which I by now have not installed and could not even consider in my "which" tests by now!
Walter Roberson
Walter Roberson on 26 Feb 2014
Huh, PSCAD turns out to be made by an organization on the first north-south road over from here. :-)
Andrew P
Andrew P on 26 Feb 2014
Yes, 6 terminal induction machines are possible in other software. PSCAD has a 6 terminal induction machine model, although I don't think it's part of their standard library.
francesco
francesco on 9 Nov 2013
enforce reporting tools, integrate latex programming.
Steven Lord
Steven Lord on 22 Sep 2017
Starting in release R2017b you can export live scripts to LaTeX.
Sean de Wolski
Sean de Wolski on 26 Feb 2014
Can you clarify? You can include inline LaTex in your comments and then when publishing this will be interpreted. You can also publish directly to LaTex.
per isakson
per isakson on 12 Sep 2013
The Find Files Tools does not honor multi-line comments. I wish it did.
I use multi-line comments to comment out "old" code that I want to keep temporarily. (I know, I should learn and trust a version control tool.) Multi-line comment is much better than single line comments because chunks of commented out code may be folded.
Example:
%{
cnx(jj).MaxSimulationElapseTime = test_request.MaxSimulationElapseTime;
und so weiter
%}
and when folded
%{...%}
In the search result for "MaxSimulationElapseTime" I cannot see that this line is commented out.
Since I believe this would be easily fixed, I find it very frustrating.
per isakson
per isakson on 2 Jan 2019
As of R2018b, the Find Files Tools still does not honor multi-line comments!
Walter Roberson
Walter Roberson on 30 Jun 2016
(This has not been implemented yet, as of R2016a)
Robert Cumming
Robert Cumming on 30 Aug 2013
From R2012b onwards - Menus are missing! :)
dpb
dpb on 28 Aug 2013
Fortran-like FORMAT statement for (primarily) input parsing...
Amongst other things, allows for fixed-width fields directly w/o character parsing, and improves format string construction by allowing repeat specifiers (no more silly butt-ugly repmat('%f',23,1) constructs, hooray!)
Re-institution of textread as fully-supported including enhancements to input options equivalent to those in textscan to all direct import of arrays instead of only cell.
dpb
dpb on 1 Dec 2017
TMW finally introduced the FixedWidthImportOptions object as whole new complex data structure w/ R2017a. AFAICT, it's only useful with readtable although the documentation doesn't specify that precisely it's only example usage given and there's no way I see for any of the previous routines like textread or textscan to be informed of its existence. At least a step forward...FORMAT would still be more than just a convenience for the other routines, however.
Walter Roberson
Walter Roberson on 30 Jun 2016
(This has not been implemented yet, as of R2016a)
dpb
dpb on 29 Aug 2013
I doubt it; textread predates textscan()
ADDENDUM Actually, textread calls a mex function dataread thru R2014b anyways...dpb
That one user doesn't find need isn't justification imo for first deprecating it and including threatening to delete it in future a release which is further breaking of compatibility if it were to happen (altho presently have backed off that threat at least temporarily) but it still isn't supported in development.
I don't see the love for cell arrays exclusively -- a justification that has been made earlier by a TMW employee has to do w/ the fact that thus one always "knows" which it is returned but my response has always been I've never had the case where I had the programmatic need to make the proposed query that I didn't already know what the answer was going to be anyway so I'm still not convinced (as you're not convinced w/ the Dkjstra argument on 0-based indexing :) ).
There's a workaround, sure, but why should one have to workaround cell array returns when all one needs is the array directly when the facility was there all along before? I don't have anything against textscan() per se; it's got its uses and need; that doesn't relegate the usefulness of textread() for its flavor when more suited.
Walter Roberson
Walter Roberson on 29 Aug 2013
I have not found myself needing such a function. You could put one together and submit it to FEX. textread() calls textscan() anyhow I seem to remember.
dpb
dpb on 29 Aug 2013
The need to do it when there's a perfectly good basic function already in TMW's hands that they're ignoring.
Walter Roberson
Walter Roberson on 29 Aug 2013
What essential difference do you see between textread() and writing a small function
function [varargout] = textread(filename, varargin)
fid = fopen(filename, 'rt'); %and add try/catch and error message
tmp = textscan(fid, varargin{:});
fclose(fid);
[varargout{:}] = tmp{:}; %add some checking for the case where fewer items were input than expected
end
Jim Hokanson
Jim Hokanson on 9 Aug 2013
Here's one I've been wishing I could do recently:
my_data(start_index::length_variable)
instead of:
my_data(start_index:start_index + length_variable - 1)
Where 'length_variable' indicates how many samples I would like from the variable being indexed.
This is obviously not as important as some other suggestions and the method of implementing it could be different, but I really dislike the typical notation that is required for accomplishing this (two references to the start variable and a subtraction, and a much less visually pleasing format).
Walter Roberson
Walter Roberson on 30 Jun 2016
(This has not been implemented yet, as of R2016a)
Cedric
Cedric on 10 Aug 2013
Or :+ for positive offset and :- for negative offset.
Jim Hokanson
Jim Hokanson on 10 Aug 2013
Sorry about the confusion on length, I'll edit the answer to clarify this point
Sean de Wolski
Sean de Wolski on 9 Aug 2013
ahh. So length is not a keyword for length of the file.
Daniel Shub
Daniel Shub on 9 Aug 2013
@Sean, that is what I though at first, but it is not length(my_data), but rather length which I assume is just a scalar of his choosing such that it could be written as my_data((0:(length-1))+start_index)
Sean de Wolski
Sean de Wolski on 9 Aug 2013
Isn't this that the end keyword is good for?
my_data(startinded:end)
Bjorn Gustavsson
Bjorn Gustavsson on 8 Aug 2013
R-style named arguments with default value handling:
function Q = interp1(x=(1:length(y)),y,method='linear')
This would provide a nice, clean and consistent handling of input parameter parsing, for those who require fancier functionality that requires varagin that could still be used.
Steven Lord
Steven Lord on 11 Mar 2021
Release R2021a adds the capability to specify name-value arguments using "name=value" in the call, like plot(x, y, LineWidth=2) instead of plot(x, y, 'LineWidth', 2). See the Release Notes for more information.
Steven Lord
Steven Lord on 12 Sep 2019
Release R2019b allows you to declare specific restrictions (and default values) for input arguments. See more in the Release Notes and the documentation page to which that note links.
Walter Roberson
Walter Roberson on 30 Jun 2016
(This has not been implemented yet, as of R2016a)
Bjorn Gustavsson
Bjorn Gustavsson on 8 Aug 2013
After trying to get the inputParser to accept a function handle as a default I became "a bit disappointed" about its current capabillities, therefore this whish. If it is possible to get something like this working in R it ought to be possible in matlab.
Jan
Jan on 8 Aug 2013
@Daniel: I agree. As for varargin this method can be applied for trailing input arguments only. You find equivalent methods in other programming languages, but the problem of ambiguities remains:
function Test(a=1, b=2)
What will happen for Test(3)? Then the default for a can only be defined, when no inputs are given, but for 1 input it is clear, that "a" is meant and not omitted.
Daniel Shub
Daniel Shub on 8 Aug 2013
I don't like code that I cannot see the logic behind. I would assume that default values would be assigned first and then non-default values. If this is the case, then length(y) would always be zero. Clearly, this isn't what is intended so the logic must be non-default values are assigned and then default values are calculated based on the non-default values (of course the ordering isn't clear to me). If y is a custom object for which the length method modifies the object, does that propagate? It seems to me the generalized logic is too hard to explain and I would rather write the less complicated specific logic and document that in my code.
Jan
Jan on 8 Aug 2013
While this can be achieve using the inputParser, the shown solution is much nicer and intuitive. +1
Harish Balaga
Harish Balaga on 15 May 2013
There is no option in simulink to simulate internal fault in Synchonous generator.. Also there is no option to measure phase currents on neutral side of generator, which is very useful in fault analysis of generator
Jim Hokanson
Jim Hokanson on 11 Apr 2013
Create a formal website for Matlab suggestions.
This isn't necessarily for Matlab as much as it is TMW in general, but what's really missing is a more appropriate setup for this type of question. I would really like to see TMW take on National Instruments model of the NI Idea exchange.
I realize this question, and similar questions like it, are perhaps meant to be banter or office discussion topics or whatever, but I think in some small way some people may hope that these answers influence company policy. As Doug points out (Answer by Doug Hull on 14 Feb 2011), the only official way to try and do this is through the enhancement request. Having submitted many enhancement requests myself, I find this route very unsatisfying.
I would prefer these requests to be public with their own rating system, similar to the NI idea exchange. I think this is a much more satisfying approach for users to provide feedback and provides TMW with the ability to see how other users feel about the suggestion. It might also be more obvious to users and encourage more participation if something formal like the idea exchange existed, instead of hiding enhancement requests behind support or in answers to random questions in the Answers section of the website.
Here's a link to the idea exchange I find the most relevant (NI Labview) but a google search may provide a more persistent link ...
Ken
Ken on 6 Feb 2013
What is missing in MATLAB?
Here is my quick thought for today (and most days when editing large sequences of code) :
In the native editor, it is nice when clicking on the if, try, for, etc... beinning construct or the end statement and it reference the line that may be far off the screen for it paired construct beginning/end but why hasn't anyone implemented the begging construct highlight to also include any of the else/catch in between constructs?
It would be nice when reviewing someone else's code to simply click on the beginning logic construct and see all sub blocks (if any) along with the location of the end construct statement.
craq
craq on 3 Apr 2013
I wondered that myself, especially since clicking on the else will show you the corresponding if. I'd add switch/case to your list.
Bramer
Bramer on 30 Dec 2012
one thing i'm finding particularly frustrating now is matlab inability to accept imaginary numbers in polar form directly. there is always the need to go through cart2pol and pol2cart everytime.I mean if its possible to enter 3+4j directly to the matlab prompt and do calculations with it, why isn't this possible with 5∠120° ??
Bramer
Bramer on 27 Mar 2013
like phasor calculations, and calculations involving mixed-representation of imaginary numbers, added to that fuzzy imaginary number calculations.
Walter Roberson
Walter Roberson on 30 Dec 2012
Could you give an example of a few kinds of calculations you would like to be able to do directly ?
Gregory Vernon
Gregory Vernon on 12 Oct 2012
Don't know if it has been said yet, but sparse matrix compatibility with GPU.
Steven Lord
Steven Lord on 23 Sep 2021
In release R2021b Parallel Computing Toolbox added or enhanced gpuArray support for 10 more functions in MATLAB, 12 in Statistics and Machine Learning Toolbox, 9 in Signal Processing Toolbox, and 11 in Audio Toolbox. I don't know offhand how many of those functions support sparse matrices.
Steven Lord
Steven Lord on 22 Sep 2017
And more functions are supported each release. See the Release Notes for more information.
Sean de Wolski
Sean de Wolski on 1 Jul 2016
There is some support for this now.
Clark Williams
Clark Williams on 11 Oct 2012
Easily defined enumerated types. You can write them manually, but it would be nice if MATLAB took care of all the work for you like modern versions of Java do.
Steven Lord
Steven Lord on 1 Jul 2016
Like this?
Herve
Herve on 24 Sep 2012
Matlab and java usually work well together, as long as you respect the correspondance table between data types.
One data type is missing from that list : complex numbers !
I (almost) allways work with complex, and I have to make special interfaces in order to get java classes to work with Matlab inputs...
Andrew Janke
Andrew Janke on 24 Jan 2021
The Java language and Java Standard Library don't have support for complex numbers. How would you like to see this implemented?
Curtis
Curtis on 14 Sep 2012
Efficiently model multi-body contact with simmechanics, currently you have to go through extensive machinations of calculating reaction forces explicitly and reflecting them back. That whole process is prone to errors. Also, flexible body dynamics would be nice as well.
Currently we use LMS Virtual.lab, that's one of 2 software packages we've found that allow flexible body dynamics co-simulated with Matlab feedback control, but the interface is awkward to "encourage" us to switch to their feedback software plug-in that doesn't have an embedded hardware link like Simulink coder.
Sooner or later Mathworks will come in direct competition with companies that used to be partners as everyone tries to expand their market and profits with a larger and larger vertical monopoly on a company's simulation workflow. That happened with National Instruments, MatrixX and PTC, Mathcad and will continue.
Matlab needs either a real 3d modeling interface and upgrade Simmechanics to handle contact or to get thoroughly embedded into every major CAD package, they ALL have dynamic simulation now.
Malcolm Lidierth
Malcolm Lidierth on 25 Jul 2012
For related comments courtesy of Fritz Lang (/Jamie Alexandre) see "Scientists of the World Unite"
K E
K E on 16 Jul 2012
I wish that when I use cell execution (CTRL-Enter from within a cell), the cell's commands would appear in the History and could be accessed by the up arrow or command completion (type first few characters of command then up arrow). If I am tinkering with commands on the command line, I have to copy/paste the commands in order to access them again later.
craq
craq on 3 Apr 2013
sorry, but I've got to disagree with you there. I like to keep my cells and command line separate. If I want to move them across, copy/paste is very fast
David Goldsmith
David Goldsmith on 25 Jun 2012
Assignment inside anonymous functions; for example, I'd like to be able to do something like:
cellfun(@(x,y) out.(x) = y, in(:,1), in(:,2))
to map a cell array, whose first column is a list of valid variable names and whose second column is a list of values for the respective fields, to an "equivalent" structure. (This "vectorization" would be consistent w/ the MATLAB philosophy/advice of avoiding for loops as much as possible.)
Walter Roberson
Walter Roberson on 30 Jun 2016
(This has not been implemented yet, as of R2016a)
Walter Roberson
Walter Roberson on 25 Jun 2012
I tested this out once, and it turned out that subsasgn() worked within a cell function. subsasgn() is not so pleasant to work with though.
For the particular task you suggest above, cell2struct() can be used.
David Goldsmith
David Goldsmith on 25 Jun 2012
I found cell2struct--to execute my example--but I still think assignment inside anonymous functions might be useful in other contexts
fabio freschi
fabio freschi on 21 May 2012
Sparse direct linear solver specific for complex symmetric (not-hermitian!) matrices
fabio freschi
fabio freschi on 12 Feb 2014
I forgot to mention that the solver is required for sparse matrices
Jan
Jan on 21 May 2012
You can call all LAPACK functions through the MEX interface directly.
Raphael Cautain
Raphael Cautain on 16 May 2012
Missing : The assignment is not yet a functional operator :
a = (b = exp1) + (c = exp2); % could give to a the value (exp1+exp2).
Notice that Mlint should accordingly recognize the popular error :
a = (b = exp1) + (c == exp2); % give a different result.
Walter Roberson
Walter Roberson on 27 Jul 2017
C and C++ need a series of rules of "sequence points" about exactly when these kinds of in-line operations take place
Jan
Jan on 21 May 2012
In C the assignment "a = b" replies the value of "b", such that "a = (b = exp1) + (c = exp2);" is equivalent to:
b = exp1; c = exp2; a = b + c;
But computing it in one line saves the time needed to find the pointer to the values.
Perhaps the JIT acceleration does this transparently already, but even if not, I do not assume that this feature would reduce the total costs of a program: programming time + debug time + runtime.
Daniel Shub
Daniel Shub on 21 May 2012
I have no idea why you would want to do this. Is there a language that allows you to? If the first example is valid, I would assume the second example should be also (assuming that c exists)
Walter Roberson
Walter Roberson on 21 May 2012
And perhaps it would be the "a =" that should be "a =="
Jan
Jan on 20 May 2012
How could MLint decide if "c=exp2" or "c==exp2" is the error?
Walter Roberson
Walter Roberson on 7 May 2012
Missing: a method to signal a running routine.
One can set a shared variable that the running routine would have to know to check, but that takes more setup and is often not well-understood.
Possibly a new mechanism could be created for the purpose of signalling, but I think that a pretty good job could be done using try/catch and error(). The main thing missing at the moment is that if one is in a callback (timer, graphics) then the suspended routine is not considered to be in the calling chain so there is no way to (for example) set up a timer that can error() a Timeout event to the suspended routine .
The semantics could get messier for parallel processing. Sometimes a timeout from one thread should just mean go on to the next thread, and sometimes a timeout from a thread should mean to shut down the entire parallel series as soon as practical.
There have been times when I have thought that it would be useful to be able to queue an event against a particular routine or particular component.
Walter Roberson
Walter Roberson on 27 Jul 2017
I wonder if some of this could be implemented with events and listeners? Though that still takes explicit sharing steps.
Walter Roberson
Walter Roberson on 30 Jun 2016
(This has not been implemented yet, as of R2016a)
chris
chris on 25 Apr 2012
Sanity
Jan
Jan on 26 Apr 2012
There is a Sanity Toolbox available in 2012b. Its main function is a regular shut down of the machine, because this is the most sane status of a computer: a reliable and the only reproducible status of a computer.
Walter Roberson
Walter Roberson on 26 Apr 2012
What I heard is that one of the big companies owns the patent on sanity and is deliberately sitting on it, refusing to use it in their own products and refusing to license it.
But then I also heard that one of the countries has classified the technology as a dangerous "weapon", due to its potential to destabilize entire countries.
Then again, I also heard that a number of companies have decided that there is simply no point in developing Sanity, as there was next to no market for it.
Daniel Shub
Daniel Shub on 19 Apr 2012
I wish there were better functions for comparing performance across platforms and versions. Something like a stable bench on steriods.
dpb
dpb on 1 Dec 2017
Compatibility is good as well, but still isn't the same as performance...still curious on that aspect. I can't point to it specifically but surely seem to recall some posts recently of comparisons when upgrading.
Walter Roberson
Walter Roberson on 30 Sep 2017
"Our second goal was to support existing graphics functionality and to minimize the disruption to MATLAB users. We did that by evaluating every change that would introduce an incompatibility in the graphics system. We tested those changes in house with over 100,000 MATLAB files and in person with a large number of advanced graphics users to determine the following:"
dpb
dpb on 30 Sep 2017
That's good but scaling, while important isn't same as the comparison to prior release -- there are still speed issues of HG2 performance relative to HG1 in absolute speed aren't there? Seeems I still see such comments fairly regularly.
Walter Roberson
Walter Roberson on 30 Sep 2017
dpb
dpb on 30 Sep 2017
Well, the conditions are a little different with it being "just" TMW to be honest rather than across a universe of different vendors. Perhaps it would be more incentive to solve some of the performance issues with newer releases to have and perhaps the present note is a cop out that admits there is a problem but don't know what to do about it so just mask it by disclaimer and not being consistent so can tell what has/hasn't really had any improvement (or worse, what suffers going forward).
I will grant there's the issue that TMW changes so much so fast that often it is apples/oranges because newer features are introduced and the old may not be what are using any longer. But, certainly core functionality that is syntax neutral at the code level should be comparable to measure what was gained/lost in the translation. One would wish more of "is it worth it?" discussion might take place before the introduction or, if there is serious penalty (HG2 comes to mind); perhaps hold off introduction and work more behind the scenes first....sometimes it might even be such that a particular implementation path just isn't the right way but if it is rolled out, then is much more difficult to retract.
Walter Roberson
Walter Roberson on 19 Apr 2012
Fixed sets of tasks and problem sizes tends to lead to benchmark-specific optimization. This was a major problem with the industry standard benchmarks of computer speed.
Daniel Shub
Daniel Shub on 19 Apr 2012
I don't know. As a start, a function that doesn't come with the note "A benchmark is intended to compare performance of one particular version of MATLAB on different machines. It does not offer direct comparisons between different versions of MATLAB as tasks and problem sizes change from version to version." It is not clear to me that you want the same tasks for testing across machines and testing across versions, but maybe something like http://www.mathworks.co.uk/matlabcentral/fileexchange/11984-benchmark/content/benchmark.m, which is basically bench with a fixed set of tasks and problem sizes, is good enough.
Jan
Jan on 19 Apr 2012
Which features do you need?
1. standard linear algebra comparisons
2. disk IO
3. multi-threading performance
4. general purpose algorithms: quicksort ad built-in and M-file, etc
5. 2D/3D graphics for ZBuffer, Painters, OpenGL renderer
6. Java performance, e.g. AES encryption
7. Generate GUI with a pile of elements
8. Time for opening the help window - it's cruel to wait 4 seconds...
9. Memory access, perhaps some large COMBINATOR (Matt Fig) calls, some recursive algorithms for stack management
10. Benchmark functions for each specific toolbox(!). I'm not interested in the speed of the NN-toolbox, but if you use it, the performance will be critical.
Daniel Shub
Daniel Shub on 5 Apr 2012
A function to check if a string clashes with an official MATLAB function. Something like Jan's UniqueFuncNames, but with support for all MATLAB toolboxes. Preferably something that can handle different MATLAB versions and input classes. In other words randi exists in 2012a, but was it a function in r2008a or is there an fft function for class int16. The "which" function is helpful for your current version, but only for toolboxes you own.
Steven Lord
Steven Lord on 1 Jul 2016
In release R2014b we added capability where MATLAB suggests which MathWorks product is required for an undefined function, which is a step towards what was requested. See the item "Suggested MathWorks products for undefined functions" in the Language and Programming section of the Release Notes for MATLAB for release R2014b for more information.
Walter Roberson
Walter Roberson on 30 Jun 2016
I have started playing with Virtual Machines on my Mac. I might still have an XP install disk around, so I could potentially install quite a few versions back. However, I have not found any way of figuring out the names of the internal routines that do not happen to have a corresponding .m file for documentation purposes.
Jan, do you have an automated discovery routine that can be pointed at a base installation? Easiest would be if it did not require running the release so I didn't have to install the old OS's.
I do not have access to all toolboxes, but we could at least get somewhere.
Walter Roberson
Walter Roberson on 30 Jun 2016
(This has not been implemented yet, as of R2016a)
Daniel Shub
Daniel Shub on 6 Apr 2012
While it would be easy, this is something that I think TMW should supply and maintain. I would think they could even automate the process.
Jan
Jan on 5 Apr 2012
It would be easy to expand UniqueFuncNames, if somebody with access to full Matlab installations assists.
Irl
Irl on 19 Mar 2012
An extension of bsxfun to more than two args. Example of desired operation (I've given it a new name, nsxfun, to avoid riskily modifying the ensconced function bsxfun):
function rslt = prod3(a,b,c);rslt=a.*b.*c;end % in editor
nsxfun(@prod3,[1 2 3],[4;5],[6;7]) % should return the same thing as
prod3(repmat([1 2 3],2,1), repmat([4;5],1,3), repmat([6;7],1,3))
Steven Lord
Steven Lord on 17 Sep 2020
Does implicit expansion satify this need, at least in part?
Walter Roberson
Walter Roberson on 30 Jun 2016
(This has not been implemented yet, as of R2016a)
Ashish Bhatt
Ashish Bhatt on 12 Mar 2012
I wish matlab could auto insert the white spaces into the expressions. For example, if I write a+b in an m-file or script, matlab would be able to make it a + b that will save a lot of effort entering white spaces before and after every operator which I am not accustomed to. I am not sure if this functionality is there in other similar software.
Walter Roberson
Walter Roberson on 30 Jun 2016
I would appreciate an auto-format that could take sections of code and apply formatting rules like space around assignment and space between operators.
Daniel Shub
Daniel Shub on 19 Mar 2012
I personally would love some sort of formatting help in the MATLAB editor. Maybe auto formating of whitespace (as long as it doesn't get it wrong) like it does with tabbing, or maybe mlint warnings:
This project uses spaces after assignments (a = b;)
This project uses spaces between operators (a + b;)
This project requires commas followed by spaces ([a, b, c])
Where I can set the coding style. Also auto warnings on name clashes (yes mlint should know the name of ALL MATLAB functions) and camelCase etc.
Sean de Wolski
Sean de Wolski on 12 Mar 2012
@Jan, agreed - very dangerous.
@Ashish, you could write a function to this if it is very important to you. Just what you do here:
fprintf('I sometimes use C+%s','+')
?
Jan
Jan on 12 Mar 2012
This will be dangerous in Matlab, which accepts some sloppy syntax. E.g. [a+b], [a +b] and [a + b] are different.
Jianwei Guo
Jianwei Guo on 28 Jan 2012
While now, I want to do 3D modeling task using matlab. And most in my need is a function that can translate mesh-surface in 3D-plot to binary volumetric image. ^_^
Dan K
Dan K on 27 Jan 2012
A true polar plot. I've been using an old copy of mmpolar (thanks Duane) for years. It seems ridiculous that the built in functionality has hard coded axis labels,etc. It's even brutal trying to adjust things that can be accessed, since the underlying coordinates are all Cartesian.
Steven Lord
Steven Lord on 30 Jun 2016
Release R2016a introduced the polarplot and polaraxes functions.
Walter Roberson
Walter Roberson on 28 Jan 2012
Also, we get a surprising number of requests for log-polar plots. Yes, that causes problems for rho that are negative, and requires an infinite amount of canvas to represent from rho = 0 to any positive rho, but people want it anyhow.
Sharif
Sharif on 26 Jan 2012
Add graphical interface that allows the user to add stochasticity to input parameters of differential equations in Simulink and MC and MCMC sampling of outputs, like Palisade at-Risk.
Andrew Newell
Andrew Newell on 25 Jan 2012
An equivalent of the UNIX command wc that allows one to determine useful information about the size of a file before reading it.
Steven Lord
Steven Lord on 9 Mar 2017
In release R2016b we introduced the detectImportOptions function that, among other things, tries to detect things like the number of header lines, the number of variables, the delimiter, etc. We increased its capabilities to handle fixed-width text files in release R2017a. This doesn't directly address Andrew's suggestion but it addresses some of Walter's.
Walter Roberson
Walter Roberson on 30 Jun 2016
(This has not been implemented yet, as of R2016a)
Walter Roberson
Walter Roberson on 26 Jan 2012
wc reads the file ;-)
What I think people would appreciate is a command that would indicate how many columns a file had. With optional header lines and optional field delimiter.
Walter Roberson
Walter Roberson on 14 Oct 2011
But can you do that in other similar software, Nitin?
c c
c c on 14 Oct 2011
Allowing square brackets for vectors and matrices, with zero base indexing, would be useful. This is:
vec[k] == vec(1+k) , with k ranging from 0 to length( vec ) - 1
Reasons: digital logic indexing naturally starts from zero. Also, porting from/to C would be easier.
dpb
dpb on 27 Jul 2017
And, at this point, I've given up hope it ever will be.
Parenthetically, just read Dijkstra's note for first time and in at least one regard he's simply wrong. Fortran (at least since F77 and the note seems to have been dated in '82) uses 1 as lower bound by default but the syntax for explicit-shape arrays is:
An explicit-shape array is declared with explicit values for the bounds in each dimension of the array. An explicit-shape specification takes the following form:
([dl:] du[, [dl:] du] ...)
dl, du
Is a specification expression indicating the lower and upper bounds of the dimension. The expression can have a positive, negative, or zero value. If necessary, the value is converted to integer type. If the optional lower bound is not specified, it is assumed to be 1.
I'll note that if the proposal is to to make all bounds universally 0 or 1 (like BASIC dialects), then I'd fall in the agin camp, too. It's only truly useful on a selective basis.
I wouldn't think it necessarily terrible if there were a global option for those who work with C interop extensively, say, but I'd only find the individual array option truly useful.
Of course, the kicker for Matlab or any interpreted language is the dynamic nature of allocation and would require the introduction of some form to set the DIMENSION to borrow from Fortran again.
Walter Roberson
Walter Roberson on 30 Jun 2016
(This has not been implemented yet, as of R2016a)
dpb
dpb on 28 Aug 2013
Fail to understand the animus against it -- while there's nothing literally that can't be done using 1-based, 'puters are supposed to be aids and if the syntactic sugar of having 0 (or N or -N:N) based indexing aids in a given application, why should the language get in the way?
Just because a given application domain for a given user/programmer doesn't lend itself to using it doesn't mean it isn't a real boon for somebody else.
Walter Roberson
Walter Roberson on 14 Oct 2011
Hmmm... I don't seem to find his reasoning to be even marginally convincing, let alone compelling. It has the look of "retcon" (retroactive continuity -- a reasoning invented to explain a "fact" that was historically chosen arbitrarily.)
Daniel Shub
Daniel Shub on 14 Oct 2011
While I think that changing, or even including, 0-based indexing is a really bad idea, I think Dijkstra makes a compelling case for 0-based indexing: http://www.cs.utexas.edu/~EWD/transcriptions/EWD08xx/EWD831.html
Walter Roberson
Walter Roberson on 14 Oct 2011
See also Jeff's suggestion of 0-based indexing.
Sean de Wolski
Sean de Wolski on 14 Oct 2011
Disagree.
Nitin Chauhan
Nitin Chauhan on 8 Oct 2011
Yes there one thing. I am not able to find out the induction machine model with stator isolated windings available with all the six stator winding terminals access.
Walter Roberson
Walter Roberson on 8 Oct 2011
Currently, "i" and "j" can be used as numeric suffixes to denote the imaginary unit.
This parsing could be extended to include pi, such as allowing someone to write
for k = 0:0.01:2pi
Of course, as 2pi is itself numeric, it should be suffixable with "i" or "j", leading to (e.g.)
exp(-2pii)
Walter Roberson
Walter Roberson on 30 Jun 2016
(This has not been implemented yet, as of R2016a)
Walter Roberson
Walter Roberson on 8 Oct 2011
Same rules as for "i" and "j" : the interpretation is only in effect when used as a suffix.
Jan
Jan on 8 Oct 2011
pii=3; exp(pii);
Do you expect -1 or 20 as result?
Royi Avital
Royi Avital on 6 Oct 2011
Built in 64 Bit Compiler to allow out of the box integration with Adobe Photoshop using 64Bit versions of the software.
Walter Roberson
Walter Roberson on 27 Jul 2017
I noticed that MATLAB does ship with lcc64 in the last couple of releases, but only or a subset of the toolboxes -- MATLAB Coder, SimBiology, FixedPoint Designer, HDL Coder, HDL Verifier
Royi Avital
Royi Avital on 31 Aug 2012
Photoshop has a MATLAB Library which requires a compiler. 32Bit Works out of the box, 64Bit won't.
I just wish MATLAB would ship with a 64Bit compiler integrated.
Walter Roberson
Walter Roberson on 6 Oct 2011
Does Adobe support such a thing?
See also this previous comment:
http://www.mathworks.com/matlabcentral/answers/1325-what-is-missing-from-matlab#answers_1917
Bert
Bert on 6 Oct 2011
Please correct me if I'm wrong, but I find the way methods are supposed to be declared and used incosistent. I.e., When you call a method, you are allowed to use both method(obj, variable) and the obj.method(variable) syntax. However, when you declare it, you can only use method(obj, variable).
Jan
Jan on 6 Oct 2011
Does this mean, removing the possibility to use "obj.method(variable)" would solve your problem?
David Goldsmith
David Goldsmith on 3 Oct 2011
"something you can do with other similar software but can't with MATLAB"
In a separate pane in the Editor window, see an expandable list of "structures" (in a generalized sense, i.e., including functions, structs, classes, imported modules, etc.) present in the currently visible tab. (I'm not as familiar w/ other IDE's as I'd like to be, but I know that Stani's Python Editor has a feature like this, IIRC, so does MS Visual Studio, and I think Eclipse does also.)
David Goldsmith
David Goldsmith on 13 Sep 2011
Support for arrays of formats in datetick, e.g., I'd like datetick to be able to produce time axes like:
| | | | | | |
09/12 00:00 06:00 12:00 18:00 09/13 00:00 06:00 12:00
by passing in something like {'mm/dd HH:MM', 'HH:MM'} for the dateform argument. (In contemplating writing this myself, I realize it is non-trivial to make such a thing robust to the variety of arrays users might try to throw at it. On the other hand, there is nothing to stop MATLAB developers from deciding on a syntax/outcome they will support and then define that in the help string: IMO, something along these lines would be better than the monochromatic status quo.)
Walter Roberson
Walter Roberson on 30 Jun 2016
R2015a introduced, and R2015b made public, the ability to apply format to ticks in axes rulers.
Walter Roberson
Walter Roberson on 13 Sep 2011
I think "monochronlogic" might perhaps be a more appropriate adjective than "monochromatic".
I think there ought to be an adjective "monochronatic" ;-)
Walter Roberson
Walter Roberson on 21 Jul 2011
fseek() cannot move past the last byte in a file, contrary to POSIX.1 .
fseek() past end of file is not an error in POSIX.
Requesting a read operation at that point is not an error but does result in the end-of-file flag being set.
Requesting a write operation at a point after end of file is conceptually equivalent to zero fill between the previous end of file and the position of the new data, except that OS's and file systems are allowed to use "gaps" with no backing disk space in the file meta-information; these are traditionally referred to as "holey files", and can be very important for the efficient implimentation of databases.
Any fseek() clears the error flag and the end of file flag from the stream, even if the system can detect that the new position would be after the end of the data actually written.
If there was any data waiting to be written out in the stream, such as if C's fwrite() or fgetc() buffered I/O had buffered data, then the data must be flushed before fseek() returns (unless perhaps asynch I/O was being used; I would need to check that.)
fseek() also handles whatever internal house-keeping is necessary so that on read/write streams, after the fseek() [no matter where to], the stream is in a state where reading or writing could be the next operation.
Reference: POSIX.1-1990 6.5.3 .
This problem was hit "in the wild" when someone fseek()'d to a few bytes in to a new file (skipping a binary header whose contents were to be determined later) and wrote data, and then was confused when fopen() + fseek() + fread() read in bogus data: the initial fseek() past end of file had silently failed so the data was being written from the beginning of the file rather than after the expected gap.
Workaround: None possible except to keep internal track of where one is supposed to be, and if/when an fwrite past end of file is done, go back to the current end of file and fwrite zeros to the current position and then allow the fwrite to proceed. If there are opaque subroutines that might move the file position, this method will not work -- at least not without overloading the I/O operations.
Miltos
Miltos on 6 Jul 2011
I am new with MATLAB so maybe I can do the following and still haven't figured out how
Can one use use
dsolve ('Dz=a*z+b*t+c(z,t)','t')
where c(z,t) is a user-defined function?
The specific form of the expression is only an example (in principle it could/should be more general). The important think here is the use of a user-defined function within the expression that gives the differential equation.
Walter Roberson
Walter Roberson on 21 Jul 2011
If c is a function defined as a MuPad proc(), and passing symbolic variables to it and evaluating that results in a symbolic expression, then Yes, dsolve should be able to solve that situation. You might, though, have to write in explicit diff() notation:
dsolve('diff(z,t) = a * z(t) + b * t + diff(c(z(t),t),t)','t')
I am guessing here about that your Dz is dz/dt even though your c(z,t) uses t as well as z.
Also, dsolve() usually expects the remaining arguments to be either further differential equations or initial equations, or the function to be solved for. There is nothing in your expression that would lead me to expect that t is a function; the diff() form I wrote certainly does not expect it.
(This is why I don't like the D shortcut notation: too many ambiguities for someone unfamiliar with the problem domain.)
Matt Fig
Matt Fig on 2 Jul 2011
Use of wild cards and regular expressions with GET and SET.
get(gca,'camera*') % Should return 8 properties
Walter Roberson
Walter Roberson on 30 Jun 2016
(This has not been implemented yet, as of R2016a)
Jan
Jan on 7 Jul 2011
@Matt: Getting the factory and default settings works for the root handle: "get(0, 'factory')". Using "P=get(gca); regexp(fieldnames(P), ...)" is an option, but not comfortable.
If additional fields have been attached to the object by "schema.prop", more than 8 fields are possible (even if this is unlikely).
Walter Roberson
Walter Roberson on 13 Jun 2011
If there is an atan2() function, why isn't there an acot2() function or acos2() or asin2() ?? Equal time for arc functions!
Andrew Newell
Andrew Newell on 13 Jun 2011
We shall overco-o-ome! We shall overco-o-ome! We shall overcome some day-a-a-a-ay!
Walter Roberson
Walter Roberson on 9 Jun 2011
Controlled time limitations.
You could start timers, and the timers could throw error(), but the timers are not parented to a code block so you cannot try/catch to control timeouts.
These time limitations I'm referring to are "non-cooperative", in the sense that the code being invoked should not have to have been written to know the time-out protocol you are using and should not have to check particular state variables or what-not.
Ideally even BLAS-level operations could be interrupted.
For example, I might want to code the equivalent of, "Give eigs() 5 minutes to come up with the solution, but if it hasn't converted by then, stop that approach and hand off to eig()"
Or I might have a function whose workings I am not familiar with. Or perhaps I'm running a unit-test framework or a framework to test class assignments.
Are the MATLAB Contest time limitations not programmable in MATLAB ?
Walter Roberson
Walter Roberson on 30 Jun 2016
(This has not been implemented yet, as of R2016a)
Ben Petschel
Ben Petschel on 8 Jun 2011
1. Distinguishing variable from function names in M-Lint. To get around the current limitation, "declare" which names are variables and which are functions, e.g. with %#fdef and %#vdef statements somewhere after the help header. These could be generated automatically e.g. via a dialogue box that asks the user to tick the boxes as to which ambiguous names are which. It would be useful for detecting uninitialized variables and other common typos.
2. Allow pausing/monitoring/debugging calculations mid-flow, e.g. with a pause button, or breakpoints that can be added during program execution, or a variable monitor window that displays variable values in a given workspace while the function/script is running. Would be very useful for monitoring long calculations without killing them.
3. multiple-line anonymous functions, or allow function declarations in scripts.
4. function calls with named arguments and default values in the function definition, e.g. "function f(x=[],n=length(x))" and "f(n=1)".
Steven Lord
Steven Lord on 12 Sep 2019
Release R2019b allows you to declare specific restrictions (and default values) for input arguments. See more in the Release Notes and the documentation page to which that note links.
Walter Roberson
Walter Roberson on 15 Sep 2016
That is a good step towards solving a common problem (though one I probably would have solved by expanding the error message...), but I suspect that now more than ever people are going to be wanting to copy and paste entire scripts with functions to the command line.
Steven Lord
Steven Lord on 15 Sep 2016
As of release R2016b you can now define local functions inside of script files.
Steven Lord
Steven Lord on 30 Jun 2016
Release R2016a introduced a Pause button in the editor. Using it temporarily interrupts execution and enters debug mode. See the item in the Desktop section of the Release Notes for MATLAB for that release.
K E
K E on 13 Jul 2012
Yes, I have always wanted that myself.
Walter Roberson
Walter Roberson on 21 Jul 2011
Pausing state for examination without ruining the calculation would be beneficial!
Walter Roberson
Walter Roberson on 7 Jun 2011
perl-like "interpolation" in strings.
For example, andrei coded
result = evalin(symengine,['simplify(' , char(expr),',exp)']);
This would have been much easier to write if it could have been done as
result = evalin(symengine,'simplify(${char(expr)},exp)');
or maybe
result = evalin(symengine,'simplify(${expr},exp)');
or with sufficient context matching,
result = evalin(symengine, 'simplify($expr,exp)');
(expr was a symbolic expression in the context.)
Interpolation is supported to a very limited extent, in regexp() and regexprep(). It is an important perl operation and it can make string construction a lot easier.
Walter Roberson
Walter Roberson on 30 Jun 2016
(This has not been implemented yet, as of R2016a)
Aurelien Queffurust
Aurelien Queffurust on 4 Apr 2011
What is missing from MATLAB?
MATLAB Suggest feature like for Google to avoid error like undefined function ...
As you type in the search box on Google Web Search , Google Suggest offers searches that are similar to the one you're typing. Imagine you would have the same feature in MATLAB, if you type for example helpa instead of help , you get the following error message:
>> helpa rand
??? Undefined function or method 'helpa' for input arguments of type 'char'.
MATLAB Suggest feature will suggest to type help rand instead !
Sean de Wolski
Sean de Wolski on 9 Aug 2013
This exists starting in R2012b.
Seth
Seth on 22 Mar 2011
Make the "pretty()" command output even prettier! ;-)
Walter Roberson
Walter Roberson on 22 Mar 2011
Have you checked out the preferences available in the MuPad print() command, http://www.mathworks.com/help/toolbox/mupad/stdlib/print.html
Oleg Komarov
Oleg Komarov on 19 Mar 2011
Axes properties should be kept independent and the level of customization should be similar to excel.
- For instance, when manipualting TickDir or TickLenght it should be possible to differentiate among the effect on the X axes and Y axes.
- Or, when setting Xcolor, it shouldn't propagate to labels or grids!
- It should be possible to add additional X,Y axes w/o creating additional axes objects.
In general I want to have a more specific control over axes properties.
Walter Roberson
Walter Roberson on 30 Jun 2016
(R2015a introduced some of these controls but under an undocumented name; R2015b used a different name and documented the facilities.)
David Goldsmith
David Goldsmith on 16 Mar 2011
Multiple inspector instances in one instance of MATLAB: I want to be able to "inspect" more than one object at a time (e.g., to be able to compare property values); presently, I have to launch a new instance of MATLAB for each distinct inspector instance I want to use simultaneously--a tremendous waste of resources! (Don't worry, I'm submitting a formal enhancement request.)
Walter Roberson
Walter Roberson on 28 Aug 2013
R2013, if I type uisetcolor into the GUI search engine, it shows up without difficulty. But if you tried to search for it without knowing the right verb (e.g., if you were looking for "pick color") then good luck.
Jan
Jan on 28 Aug 2013
@IA: It is easy to find:
docsearch color
Then it is about the 600th(!) element in the list on the left, when you sort the results alphabetically, what has been possible in the help browser of R2009a. In R2011b I do not find uisetcolor through docsearch at all. And after too many negative opinions I'm not eager to search in the help browser of R2013a.
So you are right: This will be an important enhancement request. I post a question here also, because it will be published earlier than the modified help text most likely ;-)
Image Analyst
Image Analyst on 26 Aug 2013
Yes, that's it! I think it's a major omission that this function doesn't come up when you search for "color" in the help, and it's not even listed as a "see also" in the ColorSpec page of the help. I'll send in a feature request for that. Thanks for telling us about this function.
Jan
Jan on 26 Aug 2013
@Image Analyst: Do you mean uisetcolor? Or perhaps Undocumented: color selection components
Image Analyst
Image Analyst on 26 Aug 2013
Are you saying that MATLAB has a built-in color-picker tool dialog box? What is the function called? I have a need for a user to select a color via the regular color picker kind of tool that you see in so many other applications. It will be used to specify colors for the things (text, circles, etc.) that I put into the graphical overlay above the image I've displayed. Or do I need to pick one of these from the File Exchange?
Aurelien Queffurust
Aurelien Queffurust on 7 Jul 2011
Definetly agree: inspecting mustiple uicontrols within GUIDE at the same time should be implemented!
Walter Roberson
Walter Roberson on 16 Mar 2011
I hit this yesterday. One of my first time using the inspector, dropped into the extended color-picker subsection, chose colors, and to physically write down the rgb values and close back up through several levels before I could edit the new rgb values into the code I was touching up :(
Walter Roberson
Walter Roberson on 1 Mar 2011
Extend the : operator so that if there is a value on the left side but not the right side, that the implied right limit is 'end', and if there is a value on the right side but not the left side, then the implied left limit is 1.
A(5:) -- to be equivalent to A(5:end)
A(:4) -- to be equivalent to A(1:4)
Walter Roberson
Walter Roberson on 30 Jun 2016
(This has not been implemented yet, as of R2016a)
Walter Roberson
Walter Roberson on 16 Mar 2011
All of the greats borrowed from each other ;-)
James Tursa
James Tursa on 16 Mar 2011
Like Fortran :)
Andrew Newell
Andrew Newell on 20 Feb 2011
The ungroup action for a compound graphics object like lineseries.
Walter Roberson
Walter Roberson on 27 Jul 2017
At some point someone from Mathworks mentioned that the difference between the "primitive" graphics objects and the "chart" objects (like lineseries) was in the [XYZ]Data* properties.
However, I have not gone back to check the fine differences between the modes under HG2.
Walter Roberson
Walter Roberson on 8 Jun 2011
I did see in the documentation today that Brushing applies to lineseries objects but not to line objects.
Walter Roberson
Walter Roberson on 16 Mar 2011
Okay, found a difference:
- plot() emits lineseries objects, the handle() of which has one method.
- line() emits line objects, the handle() of which has no methods.
The properties of the two are the same, including the Type, with the exception that a lineseries object adds:
XDataMode XDataSource YDataSource ZDataSource
Walter Roberson
Walter Roberson on 16 Mar 2011
Although there are some internal differences between lineseries objects and line objects, I have not yet found any practical difference between them. In particular, searching for objects of type 'line' will find lineseries objects.
David Goldsmith
David Goldsmith on 16 Mar 2011
Yes! I need this NOW!!! (I've discovered the following limitation: I've implemented brushing on some lines. At first there were only two lines per axis and everything worked beautifully. Subsequently I've had to add a bunch more lines to one of my axes using a loop over the number of data sets to plot, and I found, eventually, that the later call to "brush on" was no longer providing _any_ of the lines on this axis w/ the BrushData property! The only clue I had was that I have a BrushEnd event handler that was returning the error "??? Error using ==> set
There is no 'BrushData' property in the 'lineseries' class." Well, I wasn't (explicitly) creating any lineseries, and findobj, findall, and get were all unable to find such. I didn't think what turned out to be the problem could've possibly been it, so I didn't check it 'til I was plum out of other ideas (i.e., after more than a few hours of hair wringing) but evntually I tried adding just one more line and low and behold, no problem! So I added one more line, for a total of four on the axis, and again no problem. So I added another and "??? Error using ==> set
There is no 'BrushData' property in the 'lineseries' class." CAN IT REALLY BE THAT MATLAB UNILATERALLY AND WITHOUT NOTIFICATION GROUPS YOUR INDEPENDENTLY-MADE LINE OBJECTS INTO A LINESERIES, AND AFTER ONLY FOUR LINES!!?? How do I beat this?!)
"
Walter Roberson
Walter Roberson on 18 Feb 2011
Inspired by Carl's csvread requests:
A textscan format specifier indicating that a date was expected at that position, possibly including embedded blanks. A modifier would allow specification of one of the standard date format numbers. Output would be a serial date number.
Extra points for a format specifier that allowed the standard date elements, such as
%t{mmm yy, HH:MM}
Walter Roberson
Walter Roberson on 8 Jan 2020
readtable() and kin are getting increasingly better at deducing date format, including when there are are spaces.
Walter Roberson
Walter Roberson on 27 Jul 2017
(However, handling spaces in a %D format requires that the WhiteSpace property be set to exclude spaces.)
Walter Roberson
Walter Roberson on 30 Jun 2016
(This was implemented about R2014b.)
Aurelien Queffurust
Aurelien Queffurust on 18 Feb 2011
What is missing in MATLAB?
Here are my two quick thoughts for today :
1) More choice in default uicontrols:
Currently , user interface controls include push buttons, toggle buttons, sliders, radio buttons, edit text controls, static text controls, pop-up menus, check boxes, and list boxes.
I would like to have more custom pushbuttons . I would like to be able to modify the borderwidth (like for uipanel) , to choose another form than rectangle or square like circle , triangle ... I really feel frustrated not to be able to build a GUI with such components . Currently the only thing I do to enhance the design of my softwares is to use CData to add icons ! I always try to find the best backgroundcolor for my GUI ...changing colors is possible but not the form/appearance of the uicontrols.
Except uitable which is quite new, I didn't find any major improvement to build GUI since many years.
2) Documentation in another language
What about a French doc ?!! Translating the doc in Japanese was possible , so doing the same thing in French should be also possible .
Aurélien
Steven Lord
Steven Lord on 11 Mar 2021
1) The capability to create custom UI component classes was added in release R2020b and the ability to use them in App Designer was added in release R2021a. See the Release Notes for more information.
2) A subset of the documentation is available in French on the web in release R2021a.
Re: performance of App Designer: The Performance section of the release R2021a Release Notes lists several improvements related to graphics, UIs, and the Live Editor.
Steven Lord
Steven Lord on 13 Sep 2018

In release R2018b, the Release Notes has two entries relevant to this question:

  • "Building Apps: Faster canvas interactions in App Designer"
  • "Running Apps: Faster startup time for apps"
Steven Lord
Steven Lord on 22 Sep 2017
Bug report 1376893 was marked as fixed in release R2016b, and the Release Notes for MATLAB in both release R2017a and release R2017b say that loading apps in App Designer is faster.
Steven Lord
Steven Lord on 1 Sep 2016
That is a known issue captured in bug report 1376893.
timo
timo on 1 Sep 2016
The tool is nice , but if more than 1000 lines of generated lines of code it crawls to a halt !
Steven Lord
Steven Lord on 30 Jun 2016
App Designer, introduced in release R2016a, includes many additional components. Some of these may be of use to you; if there are others that you'd like to see included that aren't there, please submit an enhancement request with details about the components you want to see included.
Walter Roberson
Walter Roberson on 17 Feb 2011
Better integration with perl.
Currently it is necessary to write the perl script to a file and invoke perl() on the file name. Arguments after the file name are permitted but not options before the file name. This makes it impossible to use any of the perl command line options, especially the -e option to designate a short in-line script.
For example,
perl -pe 's/^/ /' foo.txt > newfoo.txt
should ideally be accepted just like on shell scripts lines, but people could probably get used to
outstring = perl('-pe', 's/^/ /', 'foo.txt'); if ischar(outstring) fid = fopen('newfoo.txt','w'); fwrite(fid, outstring); fclose(fid); end
Manual redirection is a nuisance, but having to write trivial scripts to a file in full form (without the benefit of -n or -p even) keeps perl from being used to its full benefit.
Walter Roberson
Walter Roberson on 30 Jun 2016
(This has not been implemented yet, as of R2016a. But python integration is advancing.)
Walter Roberson
Walter Roberson on 17 Feb 2011
Associative tables, such as indexing by string or arbitrary object.
Indexing by string is relatively easy to fit in to current syntax, unless the string happens to be ':' .
Indexing by more complicated objects would require a new index syntax, I suspect.
To a point, indexing by string can be simulated by structures and dynamic field names, where the first character of the field name was fixed (to avoid problems with strings that do not start with alphabetics), and where characters outside the regular range of field characters were percent-encoded with the % itself replaced by underscore, using UTF-8 representation
foo('Hi there‡') -> foo.SHi_20there_E2_80_A1
Likewise, indexing by an arbitrary (non-integer) double can use hex:
foo(pi) -> foo.D400921fb54442d18
There is a natural extension to single (float), and the extension to uintN and intN need not be hard:
foo(uint16(34163)) -> foo.U28573 where the digit after the U ('Unsigned') indicates the number of bytes. 'I' for 'signed'.
If a mechanism was added to delimit strings (e.g., '__' which is not a valid numeric encoding) then one could imagine chaining several together
foo('Hi', pi) -> foo.Shi__D400921fb54442d18
These mappings fail, though, when the encoding gets past the maximum field length, 63 characters.
Steven Lord
Steven Lord on 12 Sep 2019
Starting in release R2019b, the names of table variables can contain any character.
Walter Roberson
Walter Roberson on 27 Jul 2017
containers.Map does help for this.
The table data type has the ability to name rows and name columns. Unfortunately the column names are restricted to MATLAB variable names.
Steven Lord
Steven Lord on 1 Jul 2016
Does the table data type, introduced in release R2013b, satisfy some or all of your requirements?
Ben Petschel
Ben Petschel on 8 Jun 2011
Does containers.Map have the features you need?
Walter Roberson
Walter Roberson on 18 Feb 2011
As specifying the number of bytes for the integral types might not come naturally, and as one might want to extend to bit types that are not logically bit aligned, or for other reasons one might need a fuller descriptor, then I propose to modify the above scheme so that the descriptor is separated from the value with __ and that _ be used to specify components of the descriptor. For example,
D2_3__ might be used as the prefix for a 2 x 3 array of double precision numbers. Yes such an array would exceed 63 characters, but (A) It's the thought that counts? and (B) I have some ideas for extensions to deal with longer indices.
Walter Roberson
Walter Roberson on 17 Feb 2011
I see a certain similarity to genvarname(), but that does not generate unique mappings. For example, for char(8466) it would generate 0x2112 which would you would not be able to tell apart from the encoding for '!12'
Oleg Komarov
Oleg Komarov on 17 Feb 2011
Anti-aliasing... MYAA
Walter Roberson
Walter Roberson on 30 Jun 2016
(Anti-Aliasing was improved from R2014b or a release soon after that. I gather it still has some oddities as of R2016a.)
Michael Johnston
Michael Johnston on 3 Aug 2011
Yeah, it's kind of ridiculous that we need to go to the File Exchange to be able to produce reasonable looking figures. The figure export options in MATLAB are pretty weak because they're not WYSWIG... lots of trial and error and visits to File Exchange required to produce something that looks decent in a PDF.
Oliver Woodford
Oliver Woodford on 16 Feb 2011
More efficient compilation of MATLAB code to avoid memory churn (hence slower computation) of large arrays.
Examples:
B = exp(-(abs(sin(A)) .^ 2)) / (2 * pi);
could be compiled as a one complicated operation computed on each element of A in turn. More cleverly, for
M = any(sum(abs(A), 2) < 1);
compute the sum(abs(A), 2) one row at a time, do the comparison one element at a time, and exit when the first true element is found. I could go on.
Such improvements to the JIT compiler would be fairly simple, I reckon.
Walter Roberson
Walter Roberson on 27 Jul 2017
The "tall array" datatype must do this to some extent, I guess?
Royi Avital
Royi Avital on 16 Mar 2017
Julia has a great way to do this (Loop Fusion) using the `.` operator. We really need better Loop Fusion on Element Wise operations.
Walter Roberson
Walter Roberson on 30 Jun 2016
(This has not been implemented yet, as of R2016a)
Jan
Jan on 14 Sep 2012
The check for side-effects must be performed dynamically. Example:
f = input('Type in folder name', 's');
addpath(f);
M = any(sum(abs(A), 2) < 1);
If the added folder contains a user-defined abs.m, the JIT must check on the fly if it is free of side-effects. Of course "abs.m" could contain the next addpath()... I assume a "clear abs" is required to enable the new function. But this should only demonstrate, that the JIT have to be extremely smart when it should detect side-effects.
Walter Roberson
Walter Roberson on 17 Feb 2011
JIT can make explicit tests that the functions are built-in's known to have no side-effects, optimize that path, and have the more general path if the preconditions are not satisfied.
This could lead to mark-up in functions that promised no side effects -- and mlint could catch the obvious side-effects like disp() or assignin() or error(), and warn for suspicious constructs. error() is a tricky one, as the argument parsers widely used have to error() if the conditions are not met.
In theory, JIT could build a catalog of argument type combinations that are safe-ish for any given routine. "unconditionally safe" if all paths through the function depend only on the argument types and not (or if a path that depends on the values can be proven not to have side effects for any combination of values.) "Conditionally safe" if a particular combination of types worked but value-independence could not be reasonably proven. "Unsafe" if the combination of types was known to provoke a side effect.
"unconditionally safe" could be optimized for that type combination. "Unsafe" for that combination could not be. I'm not certain at the moment what the best behaviour would be for "conditionally safe" for a type combination.
Jan
Jan on 17 Feb 2011
The JIT compiler cannot be sure, that the functions inside the SUM have no side effects. Imagine ABS is overloaded by a private function, which prints the value to the command window in addition. Then abbreviating the inner loop would change the results.
Walter Roberson
Walter Roberson on 16 Feb 2011
Pipes / popen() / ability to communicate interactively with other programs without having to use tcp/udp .
Walter Roberson
Walter Roberson on 30 Jun 2016
(This has not been implemented yet, as of R2016a)
Walter Roberson
Walter Roberson on 16 Feb 2011
Explicit fflush()
yeah, I know fseek() to 0 bytes relative to the current position does the same thing in POSIX, but Windows doesn't promise POSIX.
Walter Roberson
Walter Roberson on 30 Jun 2016
(This has not been implemented yet, as of R2016a. I do see that the existence of the 'W' and 'A' permissions of fopen() imply that flushing is normally continually done, but when you are writing code for efficiency or communicating with an external interface, you want explicit control over flushing. This is not "discard what is in the queue" flush, this is "ensure that the buffer is sent to the I/O system" flush, which traditionally has a non-blocking form and a blocking form.)
Walter Roberson
Walter Roberson on 17 Feb 2011
And I found evidence suggesting that fseek(1,0,0) and fseek(2,0,0) don't work :(
Walter Roberson
Walter Roberson on 16 Feb 2011
More flexibility to work with I/O streams rather than having to have everything in memory.
As a simple example: unzip a single file starting from the current position in an I/O stream, rather than having to unzip to disk and read the resulting file.
Steven Lord
Steven Lord on 10 Mar 2022
This doesn't sound exactly like what you requested, but could a datastore array (introduced in release R2014b) satisfy some of your requirements for such an I/O stream, possibly if used to create a tall array?
Andrew Janke
Andrew Janke on 24 Jan 2021
I would like to see this. And conversely, there are some functions that only work on files (where you supply the file name); it would be nice to be able to supply an equivalent of Java's ByteArrayInputStream to get them to work on an in-memory buffer instead.
Walter Roberson
Walter Roberson on 30 Jun 2016
(This has not been implemented yet, as of R2016a)
Walter Roberson
Walter Roberson on 17 Feb 2011
I think it would be acceptable for this purpose to introduce a new IOStream object, with IOStream(fid) pulling out the object for the file id #fid . To start the basic properties of the IOStream would be the fields you get from applying fopen() to that fid.
A Position property when read could substitute for ftell(fid), and when set could substitute for fseek(fid,POS,'bof') .
Mainly, though, by having a distinct object class wrapping the fid, it would become easier to overload methods, especially in places where a file name string is expected as the first parameter.
imwrite(Array,IOStream(4)) would write to the given stream rather than to a file name.
This becomes more powerful when you allow IOStreams to become associated with blocks of memory, as per traditional unix memmap semantics -- which allow dual access through the fid and through memory
Or perhaps it would be better to have an IOObject class with subclasses for "stream" (non-seekable) and "block" (seekable) objects. That leads into possibilities such as asynch reads with callbacks, and scatter-gather I/O... maybe even DMA to devices...
Walter Roberson
Walter Roberson on 16 Feb 2011
Exposed documented serialization routines. Currently, to transmit Matlab variables to a different process, about the best method available is to save() to file, send the binary file, read the binary and write it to disk, and load() the variables.
Better methods must exist already for use with parallel processing, so it would help to expose and document them.
Walter Roberson
Walter Roberson on 30 Jun 2016
(This has not been implemented yet, as of R2016a)
Mike
Mike on 14 Sep 2011
Yes, Something like this is needed.
Ian
Ian on 15 Mar 2011
I would really love to see this too, even if all we have access to is the byte stream result of save we could route somewhere else. Ideally there would be a defined intermediate format.
Joan Puig
Joan Puig on 28 Feb 2011
I would love to see this implemented
Peter O'Connor
Peter O'Connor on 15 Feb 2011
ability to enter default inputs like in python as in function out=foo(bar,bar1='arr',bar2='yarr') ...
Rik
Rik on 13 Sep 2019
They're not fully done implementing it anyway; the MinGW compiler installer isn't working yet. I hope they will post something there when it is, because I will probably forget to install it untill I'm getting weird errors...
Adam
Adam on 13 Sep 2019
I hadn't even noticed R2019b is out. The e-mail notifications of a new release seem to be a little tardy I've noticed! Not that I really need the new release as soon as it is out though.
Walter Roberson
Walter Roberson on 12 Sep 2019
That's some change!
Steven Lord
Steven Lord on 12 Sep 2019
Release R2019b allows you to declare specific restrictions (and default values) for input arguments. See more in the Release Notes and the documentation page to which that note links.
Royi Avital
Royi Avital on 16 Mar 2017
I think Octave implemented this.
Walter Roberson
Walter Roberson on 30 Jun 2016
(This has not been implemented yet, as of R2016a)
Ben Petschel
Ben Petschel on 8 Jun 2011
A nice feature of the R language is non-constant default inputs, for example function(x,n=length(x)), whereas Python defines the defaults at compile time. Having this feature as well as named arguments in the function call such as foo(n=1) would save the tedium of processing varargin.
Walter Roberson
Walter Roberson on 7 Jun 2011
The best tool along these lines that I have ever seen was for DEC VAX VMS. The tool allowed one to construct conditional trees of argument processing, so that some arguments would only be expected (or given default value if missing) if other arguments were present, or so that it was possible to say that arguments were incompatible. The default values could vary depending upon which switches were used, I seem to recall. Arguments could be defined as keyword or as positional or as "positional unless given as a keyword". I no longer recall if explicit data types could be given for how the argument was to be stored, but it was possible to restrict the form of input arguments (e.g., to specify that an argument _had_ to be an integer with exponential format disallowed.) Valid values for arguments could be given as a list of specific words. Abbreviations were handled -- only as much of the word as was necessary to disambiguate it was required to be entered by the user.
I miss some features of VMS...
Walter Roberson
Walter Roberson on 17 Feb 2011
foo(bar) would be treated as foo(bar,'arr','yarr')
foo(bar,bar1) would be treated as foo(bar,bar1,'yarr')
foo(bar,bar1,bar2) would have no default applied.
Oleg Komarov
Oleg Komarov on 17 Feb 2011
I don't get it, does it mean that on the next call of foo, the second input will be automatically 'arr'?
Carl
Carl on 15 Feb 2011
Enable csvread (and similar functions) to read files containing text with the follwing options:
1. Read all values into an array of text strings
2. Read into a cell array reading any unformatted number as a number
3 Read into a cell array reading anything that can be a number as a number.
The difference between 2. and 3. is that while both would recognise 2.67 as a number the latter would also recognise that 1-Jan-2010 is a date and convert that to a number too.
I would also like to see csvwrite be able to write text arrays and cell arrays containing a mixture of scalers and strings.
Steven Lord
Steven Lord on 17 Sep 2020
The readlines function introduced in release R2020b should handle the first item.
Walter Roberson
Walter Roberson on 27 Jul 2017
readtable() handles some of this.
dpb
dpb on 29 Aug 2013
textscan() (and friends) mostly works, but has its warts.
The proposal elsewhere for Fortran FORMAT instead of C formatting would help a fair amount at least in the drudgery of writing the multiple format fields as it supports repeat specifiers and recursion.
I hadn't thought of it but the equivalent of list-directed i/o is similar to your request; the difference being that in Fortran each variable has a type whereas in Matlab they're polymorphic and can change on a whim like chameleons change color.
Carl
Carl on 21 Feb 2011
Textscan works but I find it awkward, if you have 50 columns of data you have to be careful to ensure your %s %f and %d are all in the right place. It also requires several lines of code with the fopen, fclose and the loop to read one line at a time. IMO textscan is very flexible but a pain to use and it would be nice if a single command with Matlab determining whether a value is a number of a string could be used in the majority of its current calls for easier and more maintainable programming.
Walter Roberson
Walter Roberson on 18 Feb 2011
I would have thought that textscan() would be natural for that purpose?
Carl
Carl on 18 Feb 2011
I can see the potential problems with option 3. I wasn't really thinking of formulea I was mainly concerned with date / time formats. Though even there different countries using different formats could cause confusion. It might be possible to enter a parameter or accepted date formats (eg if the parameter is "dd/mm/yyyy" and entry in the format "nn/nn/nnnn" is read in as the date number of a associated date provided it is valid).
Even having options 1 and 2 would be nice. I could then just read the data and convert the date string to numbers. I often have to read or write files which contain a date followed by a number of data for that date (usually numeric occasionally text), possibly with a row of headers at the top, and avoiding textscan would be nice.
Walter Roberson
Walter Roberson on 15 Feb 2011
Any well-known name for a constant _might_ represent the number, or it might be a comment.
A string such as sin(45) could be a number... but is it sine of 45 radians or sine of 45 degrees?
10 / 2 / 5 could be a date in 2010 or 2005, could be a date in October or February, could be the 10th or 2nd or 5th of the month. Or of course, 10 / 2 / 5 could be the number 1, since 10 / 2 could represent division and then / 5 more division...
Walter Roberson
Walter Roberson on 15 Feb 2011
Along with my suggestions about ?: and about short-circuiting (possibly via a new keyword): some manipulations including ?: and "iterators" can be implemented in terms of an operator that MuPad would call "hold" and Maple would formally call "uneval" (but would normally represent as apostrophes around an expression.)
For example, ?: can be framed in terms similar to
ifelse(condition, hold(expression1), hold(expression2))
where ifelse tests the conditions and then evaluates the first expression if it is true but evaluates the second expression if the condition is false, with the effect of the other expression suspended while it is passed as an argument. hold() of an expression need not be the same as eval(), in that eval() expects a quoted string, but hold() can build a pcode'd execution object with all of the scoping appropriate. Perhaps not so different than
@() expression
but hopefully with nicer semantics than assignin() for affecting state variables (e.g., for iterators)
This leads in to some other ideas I have that are probably worth a separate answer.
Walter Roberson
Walter Roberson on 30 Jun 2016
(This has not been implemented yet, as of R2016a)
Walter Roberson
Walter Roberson on 15 Feb 2011
Short-circuiting vectorized conditional tests. This might require introducing a new keyword.
For example,
x > y/2
would normally compute the entire element-by-element vector x(K) > Y(K)/2, and then that vector would be processed within whatever expression was around it. For example,
find(x > y/2,1,'first')
or
if any(x > y/2)
But logically these don't need the entire vector result, just a single scalar result.
A lot of the time people are working with vectors too short for BLAS to kick in, but long enough that the time savings of short-circuiting would add up.
Imagine, for example, a new keyword "first":
find(first x > y/2)
or
if first x > y/2
"first" could return either 0 or [] if not found; [] would be more consistent, and ~[] is false so ~first would work like ~any(). On the other hand, what it should return so that it works with find() and logic conditions is a good question.
Walter Roberson
Walter Roberson on 30 Jun 2016
(This has not been implemented yet, as of R2016a)
Walter Roberson
Walter Roberson on 21 Jun 2013
FEX is the MATLAB File Exchange. MEX is the MATLAB API and compiling tool for C, C++, and Fortran to interface with MATLAB.
Royi Avital
Royi Avital on 21 Jun 2013
What's the difference between FEX and MEX?
Jan
Jan on 15 Feb 2011
See these FEX submissions:
http://www.mathworks.com/matlabcentral/fileexchange/27857-anyExceed
http://www.mathworks.com/matlabcentral/fileexchange/26867-anyEq
Walter Roberson
Walter Roberson on 14 Feb 2011
eval() a char array or cell-string array as a multi-line input, allowing continuations and multi-line constructs such as
if (condition)
%do something
else
%do something else
end
Walter Roberson
Walter Roberson on 12 Nov 2013
Yes, Ben, but that string does not contain multiple lines. Commas and semi-colons do not mark the end of a line.
Ben Petschel
Ben Petschel on 12 Nov 2013
I don't understand - statements like
eval('if 1, disp(''a''); else, disp(''b''); end')
work from at least r2010a onwards
Bjorn Gustavsson
Bjorn Gustavsson on 3 Mar 2011
Amazing/amusing!
eval(sprintf('for i1 = 1:10,\n if i1>3\n disp(i1) \n else\n disp(''i1'') \n end \n end\n%%a comment\n'))
Walter Roberson
Walter Roberson on 3 Mar 2011
Interesting idea, Jan. It does appear to work in a simple test:
eval(sprintf('if true\ndisp(''true'')\nelse\ndisp(''false'')\n%%a comment\nend'))
Jan
Jan on 3 Mar 2011
You can add CHAR(10) as line breaks in EVALed strings. Does EVAL(sprintf('%s\n', CStr{:})) satisfies your needs?
Walter Roberson
Walter Roberson on 18 Feb 2011
@Jan: Imagine generating a script dynamically, which might have continuations and might have comments. You can't always process such things down to a single line. See for example the Hump-day puzzle where I found that putting everything on one line affecting shadowing.
Leon
Leon on 18 Feb 2011
I second this request, but I doubt if it will be ever supported.
Jan
Jan on 15 Feb 2011
What about: eval('if condition, disp(''condition''); else, disp(''not condition''); end') ?
Walter Roberson
Walter Roberson on 14 Feb 2011
A way to return multiple outputs from a function in an expression context, without having to resort to using a separate assignment statement.
Even if at the beginning this only allowed selecting one output to return by discarding the leading N outputs, that would help .
This is functionality that cannot be written at the user level.
dpb
dpb on 16 Mar 2017
Does not Octave have at least some of this capability I think I recall seeing? I agree (and added my vote for the Answer previously); just ran into another case on a forum query the other day where temporary created for no other reason clutters up the workspace...
Walter Roberson
Walter Roberson on 30 Jun 2016
(This has not been implemented yet, as of R2016a)
Walter Roberson
Walter Roberson on 14 Feb 2011
Currently in anonymous functions, one can execute multiple commands by using [command1, command2, command3] or other such tricks. This does not, however, work if one of the commands returns no arguments. It would help if there was a way to indicate that one wanted to execute a command that normally returned nothing and have it return (e.g.) the empty array as a place holder. A way that wasn't as nasty as evalc()
I tried feval() but that doesn't do the trick.
Walter Roberson
Walter Roberson on 30 Jun 2016
(This has not been implemented yet, as of R2016a)
Walter Roberson
Walter Roberson on 17 Feb 2011
David Young showed a trick with regexp,
but that's pretty much a more complicated way of using evalc()
Walter Roberson
Walter Roberson on 14 Feb 2011
An equivalent to the ?: operator, in which the unselected part does not get evaluated.
Walter Roberson
Walter Roberson on 30 Jun 2016
(This has not been implemented yet, as of R2016a)
David Goldsmith
David Goldsmith on 16 Mar 2011
"I've wished for the same" many times...
Jan Rubak
Jan Rubak on 14 Feb 2011
I've wished for the same, especially for use in anonymous functions.
Walter Roberson
Walter Roberson on 14 Feb 2011
The result of every expression should be further indexable by all of the index methods. This includes not only function calls but literals or expressions: e.g.,
(1:3:20)(K:K+1)
or
[struct('hello',A+5),B].hello
Rik
Rik on 27 Oct 2019
@Adam, I think we are almost there. The example given makes me shudder with the though of how novice users will misuse this to strive for more compact code instead of better readable code.
Your example makes sense, but that tends to be true for most constructs. Currently (R2019b) you can do this:
n=3;
if ~verLessThan('matlab','9.7')
table([1,2,4,7,11,14,16,17]).Var1(n)
end
Edit:
I just tested this on R2015a, and it already works, despite the release notes suggesting otherwise. That very same release notes search suggest this isn't actually something new, but is actually something that was ostensibly removed in R2010a.
%both of these work in R2015a (and presumably most releases):
n=3;table([1,2,4,7,11,14,16,17]).Var1(n)
n=3;struct('Var1',[1,2,4,7,11,14,16,17]).Var1(n)
%the struct line does error on R13 (v6.5)
Adam Danz
Adam Danz on 27 Oct 2019
I searched for this thread solely to add this recommendation only to find that not only has it already been added but is the most supported suggestion.
The use of literals in expressions has been available in Python and I disagree with some of the (8 year old) comments above that such practice would be cryptic. On the contrary, it's pretty intuitive what the following lines do:
n=3
[1,2,4,7,11,14,16,17](n)
% hypothetical ans:
% ans = 4
MINATI
MINATI on 25 Feb 2019
Also in solving ode (BY bvp4c) if we take variation of any parameter in X-axis when previously f ' varies with x
timo
timo on 1 Sep 2016
yay
Walter Roberson
Walter Roberson on 30 Jun 2016
(This has not been implemented yet, as of R2016a)
Walter Roberson
Walter Roberson on 8 Jul 2012
Raphael, the extension would not actually save any memory, except for an entry in the name table. Everything else about the expression would be shared, due to the way "copy on write" works in MATLAB.
T = expression(); T(2,3)
does not take any more memory than expression()(2,3) would. T would be created as essentially a pointer to the memory that describes the type and array dimensions of the expression and the location of the memory block, so doing the assignment only takes enough memory for the name "T" and the pointer.
Raphael Cautain
Raphael Cautain on 16 May 2012
Several old languages - not solely functional languages - have already this functionality : C, IDL ... The present situation is just a restriction, since the result is safely available in the interpreter. This extension would save memory.
@Irl : while waiting for this :
function output = getelement(expr, subs)
q = num2cell(subs);
output = expr(q{:});
end
Irl
Irl on 19 Mar 2012
A nice way to implement this without a very dangerous extension of existing syntax would be a function that simply indexes into an array, kind of like getfield: my wished-for function, call it getelement, would do this:
getelement([1 2 3;4 5 6],[2 3])
returns 6, i.e., operates like
[1 2 3;4 5 6](2,3)
David Goldsmith
David Goldsmith on 16 Mar 2011
I want this bad: I might not use it much in m-files (then again I might), but I want it _all the time_ in interactive mode, e.g., when I'm debugging!
Paulo Silva
Paulo Silva on 18 Feb 2011
Walter I accepted your answer because it was the most voted and I agree with both suggestions, lets make Matlab even better.
Matt Tearle
Matt Tearle on 17 Feb 2011
It certainly *can* make for cryptic code, but so can virtually any construct. This is a construct I've wanted a few times, and I don't think it would have been particularly cryptic in those cases.... well, not if I'd commented my code, at least... Oh. Right.
Walter Roberson
Walter Roberson on 14 Feb 2011
It is pretty standard for object-oriented languages, and has long existed in (e.g.) C. It works in Maple too. These days what is confusing is a language where for a small number of expression types it does _not_ work -- especially since half of the battle is historical parsing reasons about procedures with no arguments.
Oleg Komarov
Oleg Komarov on 14 Feb 2011
This makes code a lot more cryptic...
Andrew Newell
Andrew Newell on 14 Feb 2011
Doesn't this just make code more cryptic?
Walter Roberson
Walter Roberson on 14 Feb 2011
A notation to be able to represent multi-dimensional data, instead of having to cat(N,...) the dimensions together.
This notation should in turn be understood by (e.g.) load routines
Walter Roberson
Walter Roberson on 30 Jun 2016
(This has not been implemented yet, as of R2016a)
Walter Roberson
Walter Roberson on 14 Feb 2011
Maple and Mathematica are both able to create parseable data structures representing graphics -- data structures that are easily turned in to text and writable, and easily readable from files. Sometimes this kind of data structure manipulation of graphics is very useful. When I write in Maple, it is not uncommon for me to compute the structure and contents that I want.
Walter Roberson
Walter Roberson on 14 Feb 2011
Thanks, Andrew, I'll look it over further.
Andrew Newell
Andrew Newell on 14 Feb 2011
This article on FIG file structures is part of the answer: http://undocumentedmatlab.com/blog/fig-files-format/
Walter Roberson
Walter Roberson on 14 Feb 2011
Programmatic layout routines. I had to create my own, one pass to shrink-wrap a control to the size it needs to hold the value(s), and the second pass to position the control relative to another control.
Exporting from GUIDE produces completely unmaintainable coordinates. It is not an option for producing maintainable software.
Adam Danz
Adam Danz on 20 May 2021
Sulaymon Eshkabilov
Sulaymon Eshkabilov on 20 May 2021
Thanks. I will definitely go over this issue to find out what novelties are introduced in 2021a as soon as I install it.
Rik
Rik on 20 May 2021
@Sulaymon Eshkabilov Mathworks decided to improve on GUIDE by removing it. All templates (except blank) are already removed in R2021a, so I expect them to remove it completely in R2021b or R2022a.
For a more GUI-related discussion you may have look at this thread. If you have anything to add, feel free to comment there.
Sulaymon Eshkabilov
Sulaymon Eshkabilov on 20 May 2021
MATLAB's GUIDE has to be improved by cleaning up some automatically generated components of nested/subfunctions. It should have some explicit hints for users to ease the process of editing them w.r.t their designed GUI tools. Good luck.
Adam
Adam on 22 Mar 2019
I would also agree with Image Analyst on App Designer. I like some aspects of it and the direction it promises, but I don't find it in any way usable, for numerous reasons, a few of which I've passed on, others I have probably forgotten as I haven't used it for quite a while now.
Steven Lord
Steven Lord on 22 Mar 2019
I've forwarded this particular answer to some of the people responsible for App Designer.
Adam
Adam on 22 Mar 2019
I tend to use the GUI Layout toolbox for this kind of thing.
Image Analyst
Image Analyst on 21 Mar 2019
And AppDesigner is so cumbersome to use that I don't use it. I'd like to talk to the AppDesigner developers if I can and explain to them why it's not having quick adoption (from what I can see) and how we can improve it to a point where I can actually start using it. They probably think it's great. Well, it has promise but it's not great yet.
Walter Roberson
Walter Roberson on 21 Mar 2019
Looks like that is for App Designer use.
Steven Lord
Steven Lord on 21 Mar 2019
I'm not completely sure if this satisfies your needs, but we introduced a function uigridlayout in release R2018b that may help with laying out your app more easily.
Walter Roberson
Walter Roberson on 30 Jun 2016
(App Designer is possibly a step in this direction; I have not looked at it much.)
Walter Roberson
Walter Roberson on 14 Feb 2011
When I wraptext() inside a uicontrol, I expect it to take in to account the pop-up arrows and scroll-bar widths, so that I can wrap against my real control and then just set() the String to that result. Instead I had to use trial and error to figure out the width of each of those items and build a wrapping routine that knows the fudge-factors for each of the kinds of controls :(
Adam Danz
Adam Danz on 19 Sep 2020
Thanks for all of the updates, Steven Lord.
Steven Lord
Steven Lord on 17 Sep 2020
I have not tried this myself, but release R2020b added a WordWrap property to certain UI components that may do what you want.
Walter Roberson
Walter Roberson on 30 Jun 2016
(This has not been implemented yet, as of R2016a)
Walter Roberson
Walter Roberson on 14 Feb 2011
An ability to directly call routines written in another language by having a Matlab-level wrapper that took a structured description of how to marshal the arguments and unmarshal the results. Even if in the first version it was only usable to pass read-only values, it would make calling external routines much simpler.
Steven Lord
Steven Lord on 23 Sep 2021
The ability to directly call C and C++ library functionality and Python functionality or access Java and .NET libraries and COM components is available in MATLAB. Release R2021b added in some new capabilities for C++, Java, and Python in this space.
Walter Roberson
Walter Roberson on 14 Feb 2011
I hadn't seen that before, but when I go through it it appears to me that there a a bunch of limitations that are not necessary.
One of them is that for the 64 bit version of Matlab you have to have a C compiler to use it. There appear to be others but I need to look more closely to see if there are ways to overcome the limits that I just didn't notice.
Philip Borghesani
Philip Borghesani on 14 Feb 2011
This sounds like LOADLIBRARY to me. How is what you want different from what currently exists?
Jan
Jan on 14 Feb 2011
A long term supported version!
The current policy to fix bugs mainly by shipping a new release has the important drawback, that a new relase includes new bugs ever. If reliability is extremely important, e.g. for the prediction of the outcome of surgical operations for children, MATLAB is a fairly good choice, as long as a program runs only on the release it was developped on. I must be able to reproduce the results of a published medical study for 10 years. If such a study needs 5 years to measure the long term effects of a medical treatment, it is really unclear, if I can run MATLAB 2010b in the year 2025. Therefore MATLAB is actually not suitable for a long term study -- but there is a good argument to use it in spite of these facts: The alternatives are even worse.
dpb
dpb on 25 Feb 2019
Hadn't seen this previously until last activity link was adjacent...but it's still most apropos to real world.
Can't agree with Jan/Robert more -- in nuclear power generation field we were expected to keep similar abilities to reproduce safety-related calculations for "the life of the plant" which began as the 40-yr lifetime when applications were filed. Many of these plants are now well past that and have foreseeable futures extending another 20 years or more.
Hence, we were never able to use MATLAB for such because it wasn't stable.
Of course, it's impossible to now rerun old LIFE cross-section calculations on the Philco-3000 I ran in 1968, but at least we did have a traceable migration path.
"Geezer Alert!"
Until building inspector/fire marshall put end to it for possibly exceeding design floor loadings and the fire-safety issue, the entire outside halways of the office building were lined from one end to the other with metal shelves stacked full of "greenbar" folders of computer output. One overnight run would generate roughly 12-18" stack of printout, almost a hundred of us each doing that virtually every night added up to a lot of paper! Eventually they rented the old PigglyWiggly store and turned it into the repository for filing/retrieval identification before shipping them to the salt mines in Hutchinson, KS, for long term storage.
Walter Roberson
Walter Roberson on 30 Jun 2016
(This has not been implemented yet, as of R2016a)
Jan
Jan on 26 Apr 2012
There is a new service pack for 2010b, although it is 2012 now. I do not have 2010b, such that I cannot download the SP2 and check the improvements. But I'm positively impressed by this special support activity!
I think it is worth to announce this update in public, because it increases the user's trust in the reliability of Matlab substantially.
Horia
Horia on 3 Aug 2011
Unfortunately, you have to accept the drawbacks of new releases:
Eg:I never arrived to use Photoshop CS4 Extended from within Matlab R2009b, and R2010B, all 64 bits;and I lost a lot of time trying to apply the solutions given by Mathworks, Adobe and forums. Everything works like a charm with 2011a,Photoshop CS5 Extended and the Intel C++ compiler (all, 64 bits).
I'm sure all this is commercial strategy.To use Robert Cumming's example:what would become the car industry if it worked like Boeing?
Robert Cumming
Robert Cumming on 15 Feb 2011
I agree with this point, while compiling (or pcode) can "freeze/lockdown" code - what happens if you have to do some investigations into the internals of your code?
I work in the Aerospace industry and projects are expected to have lifecycle of 10's of years (think Boeing 747 entered service in the 60's and is still selling today). In certification, any data which is analysed/processed using any code must be re-produceable at any point in the the future - bugs and all!! ;)
So we have to keep a log of which version of Matlab was used and must be able to go back to that version if and when required.
Jan
Jan on 15 Feb 2011
Locking is not helpful: I can simply avoid installing (and buying) new Matlab releases to lock the current state. But when I compile my program, I suffer from two sources of bugs, which cannot be fixed: In my program *and* in the Matlab release.
Imagine an institute, which has very strict user-policies for security reasons and is still running e.g. Matlab 6.5 for compatibility reasons. Now the local admin found out, that this release is affected by the SPRINTF-bug, which allows to gain root privilegs. If the admin follows his contract, he has to forbid the usage of Matlab 6.5, such that I have to install the newer (and much better) Matlab release 2010b and need 3 month for checking all differences in the results to assure a certain level of reliability. After some month a new severe bug will appear, which will be fixed only by updating to a newer release. And after some month a new severe bug will appear...
Doug Hull
Doug Hull on 14 Feb 2011
Have you tried compiling? This will lock down an executable.
Walter Roberson
Walter Roberson on 14 Feb 2011
Graphic support for arbitrary unicode characters.
Walter Roberson
Walter Roberson on 27 Jul 2017
I have been able to use unicode characters with TeX, but not with LaTeX.
Walter Roberson
Walter Roberson on 30 Jun 2016
(This has been added in more places, as of R2014b. If I understand correctly there are still a few places that cannot handle Unicode; some parts of Simulink, I think I read, and the TeX and LaTeX interpreters do not have Unicode support.)
Ian
Ian on 15 Mar 2011
yes please! surely matlab should be unicode friendly by now!
Walter Roberson
Walter Roberson on 14 Feb 2011
typecast to and from char. It is silly to have to use something like
typecast(uint16(String+0),DestinationClass)
Walter Roberson
Walter Roberson on 30 Jun 2016
(This has not been implemented in MATLAB itself yet, as of R2016a)
James Tursa
James Tursa on 21 Mar 2011
New version is now posted that supports char and logical types. I *think* I got the flags set correctly for this. The main restriction is that you can't typecast from a complex input into a char or logical because that would open up the door for a memory leak. You *can* typecast non-(0 or 1) values into a logical, and MATLAB seems to be able to display and handle them correctly, but caveat emptor on that one.
Jan
Jan on 17 Mar 2011
@James: Your TYPECAST can easily expanded to mxChar arrays.
James Tursa
James Tursa on 16 Mar 2011
The current version only works with numeric types. I will have to look into the feasibility of including non-numeric types. May have to hack other parts of the mxArray (like the flags) to get this to work.
Jan
Jan on 14 Feb 2011
James Tursa's TYPECAST is smarter and uses a shared data copy for the data: http://www.mathworks.com/matlabcentral/fileexchange/17476
Walter Roberson
Walter Roberson on 14 Feb 2011
Memory mapping to the bit level.
Walter Roberson
Walter Roberson on 30 Jun 2016
(This has not been implemented yet, as of R2016a)
Walter Roberson
Walter Roberson on 17 Feb 2011
To complete the memory mapping capabilities down to a level equivalent to C's struct()
nb: C does not specify which "end" of a word the bitfields fill from, and C does not specify the size of the "word" for packing purposes, just that if the current field is too wide to fit it will be put in to the next word. It would be good if these factors could be configured during the memory mapping.
Michelle Hirsch
Michelle Hirsch on 17 Feb 2011
Walter - could you elaborate on why you would want this?
Walter Roberson
Walter Roberson on 14 Feb 2011
Explicit render to a buffer (array). There are some things that this makes much easier!
Walter Roberson
Walter Roberson on 30 Jun 2016
(This has not been implemented yet, as of R2016a)
Walter Roberson
Walter Roberson on 15 Feb 2011
Rendering to a 3D array would naturally result in RGB. Rendering to a 4D array might usefully include alpha information in some cases. I imagine that in some cases people might want to render to CMYK or YCrCb; at the moment there are a few routines that can translate RGB to CMYK or YCrCb but those need to stay within the gamut that is representable in both, and I don't know that it would be a priority to support full gamuts for those color spaces.
Now as to what rendering to a 2D array should mean... *If* the rendered area did not include any ticks or axes marks or text() or line() or patch() objects with interpolated shading... if, in other words, everything being rendered was exactly representable in terms of the current colormap, then rendering as pseudocolor indices might make sense. It does not take much, though, to destroy this -- for example, there is no current way to specify that plot lines or plot markers are to be drawn in terms of a pseudocolor index. The standard colors such as 'r' are defined as being in a "system colormap" outside of any figure colormap.
Walter Roberson
Walter Roberson on 14 Feb 2011
Think of getframe() or saveas()'s ability to save an interactive image to memory or a file. Now skip the getframe() or savas() step by allowing the user to say, e.g.,
renderer buffer VARIABLENAME
and have the pixel results written directly to the variable. You'd possibly need a dots-per-inch kind of parameter in order to determine the drawing density and the virtual screen size, and an option to only capture between certain coordinates would be nice.
For example, the other day someone asked a question in cssm: they had constructed a shaded patch and wanted to capture the pixels along the surface of it for use in further processing. Not an easy task with the current rendering, especially if you want higher resolution than is available on your screen.
Oh yeah, and this render-to-buffer option should be available in batch mode!
Andrew Newell
Andrew Newell on 14 Feb 2011
@Walter, can you expand on this a bit?
Jan
Jan on 14 Feb 2011
It would be very helpful, if the Mex-interface is completely documented. Especially the inplace write access to variables passed by reference is a holy secret - although it is possible already and would be much more efficient.
Walter Roberson
Walter Roberson on 30 Jun 2016
(This has not been implemented yet, as of R2016a)
Royi Avital
Royi Avital on 31 Aug 2012
+1
Matt Fig
Matt Fig on 14 Feb 2011
Real pass by reference.
owr
owr on 21 Jul 2011
Malcolm, databucket is nice but an issue is that subsref in objects is much slower than in native arrays. Try this:
% Start Code
N = 100000;
d1 = randn(N,1);
d2 = randn(N,1);
db1 = databucket(d1);
db2 = databucket(d2);
dres = zeros(N,1);
dbres = zeros(N,1);
tic;
for i=1:N
dres(i) = d1(i).*d2(i);
end
nativetime = toc
tic;
for i=1:N
dbres(i) = db1(i).*db2(i);
end
objecttime = toc
% End code
In terms of the original question though, Ive managed fine without explicit pass by reference. But I can understand why one would want it.
Malcolm Lidierth
Malcolm Lidierth on 27 Apr 2011
Peter
How about this?
classdef databucket < handle
properties (Access='public')
Bucket
end
methods
function obj=databucket(data)
obj.Bucket=data;
return
end
function varargout=subsref(obj, varargin)
varargout{1:nargout}=subsref(obj.Bucket, varargin{:});
return
end
function varargout=subsasgn(obj, varargin)
varargout{1:nargout}=subsasgn(obj.Bucket, varargin{:});
return
end
end
end
I've created a set classes that do something like this using data on file, either memory mapped or accessed using low-level i/o so the "Bucket" can be many Gb without having them in memory all at once. With extra work to overload size, double etc and make X(:) a special case, these "nakhur" classes can be used anywhere a double precision array can be used in m-code.
Peter O'Connor
Peter O'Connor on 15 Feb 2011
should just have an option to create matrices that act as if they were subclasses of handle (pointers).
ie a=rand(1,1000000); b=a; a(1)=2; takes a long time, a(1)~=b(1)
a=*rand(1,1000000); b=a; a(1)=2; would be fast, a(1)==b(1). this'd be practical if calling functions to modify, not copy, a large matrix.
Doug Hull
Doug Hull on 14 Feb 2011
Where does out current model not suffice?
Jeff
Jeff on 14 Feb 2011
Zero-based indexing. Also, n-based indexing. See: http://tinyurl.com/ygqmmg5
It would make some things so much easier to program.
I'd also like a goto command. Not that I would use it all that often, but I can't stand the pseudo-intellectuals who insist that using 'break', and having to figure out where the break jumps to, is cleaner than saying 'goto' (and I would use it occasionally).
Walter Roberson
Walter Roberson on 1 Mar 2021
0-based indexing is more efficient.
What gets passed around at the machine level is pointers to blocks of memory, which is to say addresses of blocks of memory. The first entry in the array is zero bytes past the beginning of the memory block. If that corresponds to a MATLAB index of 1, then MATLAB needs to subtract 1 and multiply the result by the data width, and add the base address, in order to get the memory address to look at. But there are hardware instructions that have multiplying by data widths and adding a base address built into them.. but those hardware addresses do not have subtracting 1 built into them. So at the very least MATLAB has to take the index value, copy it into a register, decrement it, and then apply the hardware instruction that does the proper addressing. Whereas if MATLAB were using 0 based addressing, MATLAB would be able to take the index value directly (without copying into register and decrementing) into the hardware instruction that does proper addressing.
In some cases of consecutive memory being accessed, MATLAB can load the base address, take the starting index, subtract 1, and use the instructions, and then for the next cycle, increment the index by 1 each time, so in some cases the overhead is not much, if you are using linear indexing or working a column at a time. However, in order to do this properly efficiently, MATLAB has to create a temporary pointer that logically addresses before (or after) a memory block, and that can lead to virtual page faults (causing memory to be paged in even though it will not be used), or can lead to the operating system generating a memory restriction fault for pointing to memory not owned. So it can turn out to be necessary to transfer the pointer from "memory address register" into "arithmetic register" to do the proper base pointer adjustment, and then transfer from arithmetic register back to address register.
... Things that are mathematically equivalent are not always equivalent at the hardware level, for efficiency or security reasons.
dpb
dpb on 1 Mar 2021
Talk to professional in signal processing or who interfaces with C a lot, then... :)
Duijnhouwer
Duijnhouwer on 1 Mar 2021
I never understood what is the point of zero based indexing. Mathematics has been doing fine with 1-based indexing for centuries.
dpb
dpb on 15 Feb 2020
And likely, given TMW's apparent mindset, never will be. :(
Walter Roberson
Walter Roberson on 30 Jun 2016
(Neither arbitrary-based indexing nor GOTO have been implemented yet, as of R2016a)
dpb
dpb on 29 Aug 2013
I disagree w/ the conclusions of Jan that GOTO really has major detrimental effects regarding optimization and so on. Fortran has dealt with it for ages and all a break is is a GOTO, anyway, just w/ a particular target.
IF, CASE and the like generally end up as GOTOs (JMP, BRA, etc.) as well, in the end...
dpb
dpb on 28 Aug 2013
That there are reasons to avoid indiscriminate GOTOs is unarguable; that there should be a "nanny-state" language restriction that enforces it completely such that the occasional useful places can't be is, simply, just wrong. It's the programmer's job, not the language's.
I'm also in favor of variable-based indexing, not just zero.
Jan Rubak
Jan Rubak on 15 Feb 2011
@Jan Simon: Heheh, but my employer would be wont to indent me back.
I'm not sure I take your meaning on zero-based indexing, or the relevance of FAQ4.6. No matter, I'm not really holding my breath for that one anyway, since it's mainly a convenience issue and probably not worth the incidental confusions that it would introduce.
Interesting thoughts on GOTO. You obviously program at a much deeper level than I do.
Jan
Jan on 15 Feb 2011
@Jan Rubak: So you should indent your employer, and not the source code.
Before anyone is confused: You can look in my FEX submission to find out, that I do use code indentation. And I've enabled the modern syntax highlighting and parenthesis matching in my editor also. But when I program in Sinclair-Basic on my ZX81...
Zero- or n-based indexing are often a strong indicator for a programmer, who confused the data representation and the actual values. I see similarities between "x(0)" and "x0", such that the FAQ4.6 shows a valid and cleaner alternative.
GOTO would impede the efficient management of the calling stack and nested loops. I assume a lot of JIT accelerations would be impossible, if the program can hop occasionally to another context. Therefore GOTO is not just a question of taste, but the possibility to GOTO anywhere would have remarkable effects to the processing speed of Matlab.
My conclusion: 0-based indexing and GOTO will add more problems than it solves.
Jan Rubak
Jan Rubak on 15 Feb 2011
@Jan "As long as you avoid to insert bugs, you don't have to read the source ever again." Boy, I wish my employer ever gave me functional specifications that were complete (or static) enough that bug-fixing was the only reason I'd ever have to revisit my source codes. Even if they did, if the project is complex enough, it is often much more cost-effective (time-wise) to code-test-debug-repeat than it is to ensure a perfect finished product in rev 0.1. That said, we're all allowed to follow our own coding paradigms, of course.
Jan Rubak
Jan Rubak on 15 Feb 2011
Lol. I assumed that Jan was being facetious about the code indentations---apparently not. I guess he's never had to modify somebody else's obfuscated code. Anyway, in the spirit of freedom, and of everyone being grown-ups, I think that MATLAB should continue to allow that Jan to write non-indented code and this Jan to indent and otherwise format his code to his heart's content, and indeed to even allow Jeff (who clearly knows of Dijkstra's warning) to use the occasional GOTO statement if he feels that it'll lead to cleaner code.
As someone who prototypes in MATLAB and then implements in C++, I too would be delighted if there was some switch that I could set an m-file or a variable to use zero-based (or n-based) indexing.
Walter Roberson
Walter Roberson on 14 Feb 2011
I have indented code in Eval calls.
Andrew Newell
Andrew Newell on 14 Feb 2011
@Jan, I admire your confidence!
Jan
Jan on 14 Feb 2011
@Andrew: I let Matlab read my code. As long as you avoid to insert bugs, you don't have to read the source ever again. In addition indentation impedes beginners - or have you ever seen indented code inside an EVAL call?!
Andrew Newell
Andrew Newell on 14 Feb 2011
@Jan, fast and efficient are both good, but how about readable?
Walter Roberson
Walter Roberson on 14 Feb 2011
try
%statement group 1 here
catch: "GOTO150"
end
%statement group 2 here
error("GOTO150")
Matt Fig
Matt Fig on 14 Feb 2011
LOL Jan. Even without that horrible indentation, just count the ENDs...
Jan
Jan on 14 Feb 2011
@Matt: Just disable the code indentation and try to follow your breaks in a nested loop.
*I* can't stand people insisting on the supposed advantage of code indentation: An indented program does not run neither faster nor more efficient nor more reliably, therefore indentation is just a waste of space and a pseudo-intellectual habit.
Sean de Wolski
Sean de Wolski on 14 Feb 2011
Not enough o's Oleg,
Booooooohhhhhhhhh!!!
Oleg Komarov
Oleg Komarov on 14 Feb 2011
Boohhhhhhhhh!!!
Matt Fig
Matt Fig on 14 Feb 2011
I would be interested in seeing an example where a BREAK command is hard to follow.
Doug Hull
Doug Hull on 14 Feb 2011
The most effective way to put in an enhancement request for MATLAB is shown here.
It is fine to discuss things, but this forum is not guaranteed to be seen by the right people. The above link is.
Julian
Julian on 21 Apr 2011
Doug, may I ask how does one view/navigate/search the enhancement requests submitted this way? Mathworks.com search allows you to search Bug Reports (for example), but I could not see "enhancement requests". Thanks.
Michelle Hirsch
Michelle Hirsch on 17 Feb 2011
I'm certainly watching the discussion! Jan's idea is a good one. You may want to mention if a particular suggestion happened to get lots of votes.
Thanks to all of you for your input.
Jan
Jan on 14 Feb 2011
I suggest: Discuss at first here, forward the results afterwards.
Sean de Wolski
Sean de Wolski on 14 Feb 2011
Mathcad-like sheets, where things can be easily displayed for the purpose of someone checking your calculations.
Steven Lord
Steven Lord on 15 Mar 2018
In release R2018a, we introduced the ability to create live functions and to debug code in the Live Editor.
Walter Roberson
Walter Roberson on 30 Jun 2016
("live scripts" as of R2016a goes part way towards this. But only for scripts, where-as I write nearly all my non-trivial code into functions.
K E
K E on 12 Jan 2012
And you could insert figures/links/cartoons
Royi Avital
Royi Avital on 6 Oct 2011
This would be great. Moreover it will be better way to document a code.