Path: news.mathworks.com!not-for-mail
From: "Steven Lord" <slord@mathworks.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Suggesting improvements to Matlab
Date: Fri, 3 Aug 2007 13:00:56 -0400
Organization: The MathWorks, Inc.
Lines: 123
Message-ID: <f8vn08$ju8$1@fred.mathworks.com>
References: <f8vib1$sb7$1@fred.mathworks.com>
Reply-To: "Steven Lord" <slord@mathworks.com>
NNTP-Posting-Host: lords.dhcp.mathworks.com
X-Trace: fred.mathworks.com 1186160456 20424 144.212.105.187 (3 Aug 2007 17:00:56 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 3 Aug 2007 17:00:56 +0000 (UTC)
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3138
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3138
Xref: news.mathworks.com comp.soft-sys.matlab:422379



"Oliver Woodford" <o.j.woodford.98@cantab.net> wrote in message 
news:f8vib1$sb7$1@fred.mathworks.com...
> Hi all
>
> I'm sure we all have improvements we'd like to make to
> Matlab - my colleagues and I are forever discussing them. I,
> for one, have no idea how to go about suggesting them to
> MathWorks, but doubt they would be implemented if I did
> anyway. Instead I thought I'd send them here for feedback
> and to gauge support. Others might add their own suggestions
> also. One of the MathWorks team might see them too.

The best way to send them to us is to use the first link under "Product 
Feedback" on the Contact Us page linked at the top of most of the pages on 
The MathWorks website:

http://www.mathworks.com/company/aboutus/contact_us/

or, if you're in a country where we have a local office, you can contact 
that office.  They'll make sure to enter your suggestions into our 
enhancement database.  [Of course, you can both post them here and send them 
to us via that form.  You should mention that in your post if you do both 
send and post.]

Sending your enhancement requests to your local office or to our 
headquarters here in Natick lets us track how many users request each 
feature more consistently than if we simply copy the request off the 
newsgroup.

> Firstly it's important to note that improvements should not
> break any old code - I don't believe these do, as long as
> the code doesn't rely on any errors occurring (which may no
> longer occur due to extended functionality).
>
> Improvements to array operators (+, -, .*, ./):
> Currently you can use these on two matrices of the same
> size, or a matrix and a scalar.
> I would like them to also be valid for a larger set of pairs
> of matrices, which would include any pair of matrices A and
> B where each dimension of A is either the same as the
> respective dimension of the B, or 1.
> This would allow you to combine (using the above operators)
> A and B, where (for example):
> size(A) = [1 3 4 1 1];
> size(B) = [10 3 4 7 2];
> Currently you would do:
> B + repmat(A, [10 1 1 7 2]);
> or use nested for loops.
> The benefit of having this functionality built in is that
> you don't need to waste time and memory replicating data (or
> doing for loops). It would be especially useful when B is
> huge and A is small.

As Peter mentioned, this is possible with BSXFUN.  If we made the existing 
operators behave the same way as BSXFUN did, though, as you note it would be 
a backwards incompatibility in that code that depended on (to use your 
example) A+B throwing an error would change behavior.

We do have an entry in our enhancement database to consider a way to have 
the functionality of BSXFUN in operator form.

> Improvement to print():
> Currently print can send a figure to a printer or save it to
> a file. I would like it to also be able to save a figure as
> a bitmap in a Matlab array. This would enable me to do some
> post processing on the figure, without having to reload it
> from disk (slow). It would also allow getframe() to use
> print(), instead of doing its crazy screen grabbing trick
> which causes the current figure to be brought into focus -
> very irritating if you are trying to do something else.

There's an entry for that in the enhancement database as well.

> Improvement to size():
> Currently size only returns one or all dimensions. However,
> I may want a subset of dimensions. It would be nice if size did:
> function S = improved_size(A, d)
> S = size(A);
> if nargin > 1
>   S = S(d);
> end
> return
> This means I can write size(A, [1 2]) and get back the first
> two dimensions only. Clearly I can use the above function
> instead, but why isn't it built in to size()?

That's also in the enhancement database.

BTW, your function would need to be slightly tweaked:


function thesizes = mysize(A, dims)
% Get the sizes of A
n = size(A);
if nargin < 1
  thesizes = n;
  return
end
% Preallocate the vector/matrix output
thesizes = ones(size(dims));
% Mask for those elements of dims > ndims(A)
ldA = (n <= numel(thesizes));
% The engine
thesizes(ldA) = n(dims(ldA));


If you ask for the size of a matrix in a dimension greater than the number 
of dimensions it has, you receive 1.  For instance, size(ones(2, 3), 795) 
returns 1.

> Edit the status bar (right of 'Start' button):
> It would be great to be able to write to the status bar.
> This would allow you to display info on the progress of a
> function without needing a separate figure or waitbar.

This, too, is in the enhancement database.  Thanks for the good suggestions.

-- 
Steve Lord
slord@mathworks.com