Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

What is missing from MATLAB?

Asked by Paulo Silva on 14 Feb 2011
Latest activity Commented on by dpb on 28 Feb 2014

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?

4 Comments

Walter Roberson on 14 Oct 2011

But can you do that in other similar software, Nitin?

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.

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. :-)

Paulo Silva

Products

No products are associated with this question.

84 Answers

Answer by Walter Roberson on 14 Feb 2011
Accepted answer

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

9 Comments

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)

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

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.

Walter Roberson
Answer by Jan Simon 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.

5 Comments

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.

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?

Jan Simon 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.

Jan Simon
Answer by Matt Fig on 14 Feb 2011

Real pass by reference.

4 Comments

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.

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.

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.

Matt Fig
Answer by 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

My Blog for MATLAB geeks

0 Comments

Aurelien Queffurust
Answer by Walter Roberson on 14 Feb 2011

Graphic support for arbitrary unicode characters.

1 Comment

Ian on 15 Mar 2011

yes please! surely matlab should be unicode friendly by now!

Walter Roberson
Answer by 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.

3 Comments

Joan Puig on 28 Feb 2011

I would love to see this implemented

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.

Mike on 14 Sep 2011

Yes, Something like this is needed.

Walter Roberson
Answer by Oleg Komarov on 17 Feb 2011

Anti-aliasing... MYAA

1 Comment

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.

Oleg Komarov
Answer by Jan Simon 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.

1 Comment

Jan Simon
Answer by 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.

0 Comments

Walter Roberson
Answer by 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.

3 Comments

Jan Simon on 14 Feb 2011

I suggest: Discuss at first here, forward the results afterwards.

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.

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.

Doug Hull
Answer by Daniel 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.

2 Comments

Jan Simon on 5 Apr 2012

It would be easy to expand UniqueFuncNames, if somebody with access to full Matlab installations assists.

Daniel 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.

Daniel
Answer by 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

0 Comments

Walter Roberson
Answer by Walter Roberson on 14 Feb 2011

An equivalent to the ?: operator, in which the unselected part does not get evaluated.

2 Comments

Jan Rubak on 14 Feb 2011

I've wished for the same, especially for use in anonymous functions.

David Goldsmith on 16 Mar 2011

"I've wished for the same" many times...

Walter Roberson
Answer by 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') ...

4 Comments

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.

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...

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.

Peter O'Connor
Answer by 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.

1 Comment

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
Answer by Walter Roberson on 16 Feb 2011

Pipes / popen() / ability to communicate interactively with other programs without having to use tcp/udp .

0 Comments

Walter Roberson
Answer by 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}

0 Comments

Walter Roberson
Answer by 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.)

7 Comments

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 Simon 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 ;-)

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.

David Goldsmith
Answer by 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)".

2 Comments

Walter Roberson on 21 Jul 2011

Pausing state for examination without ruining the calculation would be beneficial!

K E on 13 Jul 2012

Yes, I have always wanted that myself.

Ben Petschel
Answer by 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.

1 Comment

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.

Dan K
Answer by Sean de Wolski on 14 Feb 2011

Mathcad-like sheets, where things can be easily displayed for the purpose of someone checking your calculations.

2 Comments

Royi Avital on 6 Oct 2011

This would be great. Moreover it will be better way to document a code.

K E on 12 Jan 2012

And you could insert figures/links/cartoons

Sean de Wolski
Answer by Walter Roberson on 14 Feb 2011

Explicit render to a buffer (array). There are some things that this makes much easier!

3 Comments

Andrew Newell on 14 Feb 2011

@Walter, can you expand on this a bit?

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!

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
Answer by 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.

0 Comments

Walter Roberson
Answer by 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

8 Comments

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'))

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

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.

Walter Roberson
Answer by 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.

3 Comments

Jan Simon on 15 Feb 2011

See these FEX submissions:

http://www.mathworks.com/matlabcentral/fileexchange/27857-anyExceed

http://www.mathworks.com/matlabcentral/fileexchange/26867-anyEq

Royi Avital on 21 Jun 2013

What's the difference between FEX and MEX?

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.

Walter Roberson
Answer by 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.

0 Comments

Walter Roberson
Answer by Matt Fig on 2 Jul 2011

Use of wild cards and regular expressions with GET and SET.

get(gca,'camera*') % Should return 8 properties

1 Comment

Jan Simon 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).

Matt Fig
Answer by Walter Roberson on 14 Feb 2011

Memory mapping to the bit level.

2 Comments

Michelle Hirsch on 17 Feb 2011

Walter - could you elaborate on why you would want this?

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.

Walter Roberson
Answer by 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.

1 Comment

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
Answer by 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)

2 Comments

James Tursa on 16 Mar 2011

Like Fortran :)

Walter Roberson on 16 Mar 2011

All of the greats borrowed from each other ;-)

Walter Roberson
Answer by 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.

0 Comments

Oleg Komarov
Answer by 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 ?

0 Comments

Walter Roberson
Answer by 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!

1 Comment

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
Answer by 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.

3 Comments

Jan Simon 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.

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','+')

?

Daniel 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.

Ashish Bhatt
Answer by 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.

1 Comment

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.

Ken
Answer by 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 ...

http://forums.ni.com/t5/LabVIEW-Idea-Exchange/idb-p/labviewideas

0 Comments

Jim Hokanson
Answer by per isakson on 12 Sep 2013
Edited by 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.

0 Comments

per isakson
Answer by 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).

16 Comments

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.

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.

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...

Jeff
Answer by 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)

4 Comments

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 Simon on 17 Mar 2011

@James: Your TYPECAST can easily expanded to mxChar arrays.

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.

Walter Roberson
Answer by 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.

2 Comments

Philip Borghesani on 14 Feb 2011

This sounds like LOADLIBRARY to me. How is what you want different from what currently exists?

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.

Walter Roberson
Answer by 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 :(

0 Comments

Walter Roberson
Answer by 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.

2 Comments

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 on 14 Feb 2011

Thanks, Andrew, I'll look it over further.

Walter Roberson
Answer by 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.

1 Comment

Walter Roberson on 17 Feb 2011

David Young showed a trick with regexp,
http://www.mathworks.com/matlabcentral/answers/1455-hump-day-puzzler
put that's pretty much a more complicated way of using evalc()

Walter Roberson
Answer by 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.

0 Comments

Walter Roberson
Answer by 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.

3 Comments

Jan Simon 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 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 Simon 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.

Oliver Woodford
Answer by 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.

3 Comments

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'

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.

Ben Petschel on 8 Jun 2011

Does containers.Map have the features you need?

Walter Roberson
Answer by Andrew Newell on 20 Feb 2011

The ungroup action for a compound graphics object like lineseries.

4 Comments

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.

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 on 8 Jun 2011

I did see in the documentation today that Brushing applies to lineseries objects but not to line objects.

Andrew Newell
Answer by 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 !

Blog MATLAB geeks

1 Comment

Sean de Wolski on 9 Aug 2013

This exists starting in R2012b.

Aurelien Queffurust
Answer by 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.

0 Comments

Walter Roberson
Answer by 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.

0 Comments

Walter Roberson
Answer by 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.)

1 Comment

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" ;-)

David Goldsmith
Answer by 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.)

0 Comments

David Goldsmith
Answer by 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)

2 Comments

Jan Simon on 8 Oct 2011

pii=3; exp(pii);
Do you expect -1 or 20 as result?

Walter Roberson on 8 Oct 2011

Same rules as for "i" and "j" : the interpretation is only in effect when used as a suffix.

Walter Roberson
Answer by 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.

1 Comment

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.

Andrew Newell
Answer by Daniel on 19 Apr 2012

I wish there were better functions for comparing performance across platforms and versions. Something like a stable bench on steriods.

3 Comments

Jan Simon 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 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.

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
Answer by 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.

0 Comments

Walter Roberson
Answer by 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.

1 Comment

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

K E
Answer by 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.

4 Comments

Daniel 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 Simon 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.

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.

Bjorn Gustavsson
Answer by Jim Hokanson on 9 Aug 2013
Edited by Jim Hokanson on 10 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).

5 Comments

Sean de Wolski on 9 Aug 2013

ahh. So length is not a keyword for length of the file.

Jim Hokanson on 10 Aug 2013

Sorry about the confusion on length, I'll edit the answer to clarify this point

Cedric Wannaz on 10 Aug 2013

Or :+ for positive offset and :- for negative offset.

Jim Hokanson
Answer by 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.

4 Comments

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 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 on 29 Aug 2013

I doubt it; textread predates textscan()

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.

dpb
Answer by Robert Cumming on 30 Aug 2013

From R2012b onwards - Menus are missing! :)

0 Comments

Robert Cumming
Answer by 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!

0 Comments

Marco
Answer by 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.

5 Comments

Walter Roberson on 18 Feb 2011

I would have thought that textscan() would be natural for that purpose?

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.

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
Answer by Seth on 22 Mar 2011

Make the "pretty()" command output even prettier! ;-)

1 Comment

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

Seth
Answer by 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.

1 Comment

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.)

Miltos
Answer by 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).

1 Comment

Jan Simon on 6 Oct 2011

Does this mean, removing the possibility to use "obj.method(variable)" would solve your problem?

Bert
Answer by 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.

2 Comments

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

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.

Royi Avital
Answer by 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.

5 Comments

Daniel 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 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.)

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.

c c
Answer by 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.

0 Comments

Sharif
Answer by 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. ^_^

0 Comments

Jianwei Guo
Answer by 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))

0 Comments

Irl
Answer by chris on 25 Apr 2012

Sanity

2 Comments

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.

Jan Simon 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.

chris
Answer by 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.

4 Comments

Walter Roberson on 21 May 2012

And perhaps it would be the "a =" that should be "a =="

Daniel 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)

Jan Simon 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.

Raphael Cautain
Answer by fabio freschi on 21 May 2012

Sparse direct linear solver specific for complex symmetric (not-hermitian!) matrices

2 Comments

Jan Simon on 21 May 2012

You can call all LAPACK functions through the MEX interface directly.

fabio freschi on 12 Feb 2014

I forgot to mention that the solver is required for sparse matrices

fabio freschi
Answer by 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.)

2 Comments

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

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
Answer by Malcolm Lidierth on 25 Jul 2012

For related comments courtesy of Fritz Lang (/Jamie Alexandre) see "Scientists of the World Unite"

http://www.youtube.com/watch?v=1lBeungEnx4

0 Comments

Malcolm Lidierth
Answer by 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.

0 Comments

Curtis
Answer by 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...

0 Comments

Herve
Answer by 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.

0 Comments

Clark Williams
Answer by Gregory Vernon on 12 Oct 2012

Don't know if it has been said yet, but sparse matrix compatibility with GPU.

0 Comments

Gregory Vernon
Answer by 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° ??

2 Comments

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 ?

Bramer on 27 Mar 2013

like phasor calculations, and calculations involving mixed-representation of imaginary numbers, added to that fuzzy imaginary number calculations.

Bramer
Answer by Raj 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

0 Comments

Raj
Answer by francesco on 9 Nov 2013
Edited by francesco on 20 Feb 2014

enforce reporting tools, integrate latex programming.

1 Comment

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.

http://www.mathworks.com/help/releases/R2013b/matlab/matlab_prog/publishing-matlab-code.html

francesco
Answer by 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.

1 Comment

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)?

Bjorn Gustavsson

Contact us