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?
No products are associated with this question.
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
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)
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
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.
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.
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.
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?
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.
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
Real pass by reference.
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.
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.
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.
Graphic support for arbitrary unicode characters.
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.
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.
Anti-aliasing... MYAA
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.
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.
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.
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.
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.
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
An equivalent to the ?: operator, in which the unselected part does not get evaluated.
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.
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...
Pipes / popen() / ability to communicate interactively with other programs without having to use tcp/udp .
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}
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.)
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 :(
Definetly agree: inspecting mustiple uicontrols within GUIDE at the same time should be implemented!
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)".
Pausing state for examination without ruining the calculation would be beneficial!
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.
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.
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.
It would be easy to expand UniqueFuncNames, if somebody with access to full Matlab installations assists.
Mathcad-like sheets, where things can be easily displayed for the purpose of someone checking your calculations.
This would be great. Moreover it will be better way to document a code.
Explicit render to a buffer (array). There are some things that this makes much easier!
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!
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.
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.
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
You can add CHAR(10) as line breaks in EVALed strings. Does EVAL(sprintf('%s\n', CStr{:})) satisfies your needs?
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'))
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'))
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.
ability to enter default inputs like in python as in function out=foo(bar,bar1='arr',bar2='yarr') ...
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.
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...
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.
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.
Use of wild cards and regular expressions with GET and SET.
get(gca,'camera*') % Should return 8 properties
@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).
Memory mapping to the bit level.
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.
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.
And I found evidence suggesting that fseek(1,0,0) and fseek(2,0,0) don't work :(
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)
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.
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 ?
If there is an atan2() function, why isn't there an acot2() function or acos2() or asin2() ?? Equal time for arc functions!
We shall overco-o-ome! We shall overco-o-ome! We shall overcome some day-a-a-a-ay!
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.
This will be dangerous in Matlab, which accepts some sloppy syntax. E.g. [a+b], [a +b] and [a + b] are different.
@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','+')
?
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.
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.
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
typecast to and from char. It is silly to have to use something like
typecast(uint16(String+0),DestinationClass)
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.
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.
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.
This sounds like LOADLIBRARY to me. How is what you want different from what currently exists?
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.
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 :(
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.
This article on FIG file structures is part of the answer: <http://undocumentedmatlab.com/blog/fig-files-format/>
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.
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()
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.
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.
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.
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.
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.
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.
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'
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.
The ungroup action for a compound graphics object like lineseries.
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.
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
I did see in the documentation today that Brushing applies to lineseries objects but not to line objects.
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.
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.
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.)
I think "monochronlogic" might perhaps be a more appropriate adjective than "monochromatic".
I think there ought to be an adjective "monochronatic" ;-)
"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.)
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)
Same rules as for "i" and "j" : the interpretation is only in effect when used as a suffix.
An equivalent of the UNIX command wc that allows one to determine useful information about the size of a file before reading it.
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.
I wish there were better functions for comparing performance across platforms and versions. Something like a stable bench on steriods.
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.
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.
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.
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.
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.
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).
@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: 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 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.
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.
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.
I would have thought that textscan() would be natural for that purpose?
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.
Make the "pretty()" command output even prettier! ;-)
Have you checked out the preferences available in the MuPad print() command, http://www.mathworks.com/help/toolbox/mupad/stdlib/print.html
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 !
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.
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.)
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).
Built in 64 Bit Compiler to allow out of the box integration with Adobe Photoshop using 64Bit versions of the software.
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
Photoshop has a MATLAB Library which requires a compiler. 32Bit Works out of the box, 64Bit won't.
I just wush MATLAB would ship with a 64Bit compiler integrated.
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.
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
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.)
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.
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. ^_^
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))
Sanity
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.
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.
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)
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.
Sparse direct linear solver specific for complex symmetric (not-hermitian!) matrices
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.)
I found cell2struct--to execute my example--but I still think assignment inside anonymous functions might be useful in other contexts
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.
For related comments courtesy of Fritz Lang (/Jamie Alexandre) see "Scientists of the World Unite"
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.
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...
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.
Don't know if it has been said yet, but sparse matrix compatibility with GPU.
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° ??
Could you give an example of a few kinds of calculations you would like to be able to do directly ?
2 Comments
Direct link to this comment:
http://mathworks.com/matlabcentral/answers/1325#comment_39427
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.
Direct link to this comment:
http://mathworks.com/matlabcentral/answers/1325#comment_40480
But can you do that in other similar software, Nitin?