Ideas
Follow


Rik

What is missing from MATLAB #2 - the next decade edition

Rik on 31 Jul 2020
Latest activity Reply by Walter Roberson on 18 Oct 2023

Meta threads have a tendency to grow large. This has happened several times before (the wishlist threads #1 #2 #3 #4 #5, and 'What frustrates you about MATLAB?' #1 and #2).
No wonder that a thread from early 2011 has also kept growing. After just under a decade there are (at time of writing) 119 answers, making the page slow to load and navigate (especially on mobile). So after a friendly nudge; here is a new thread for the things that are missing from Matlab.
Same question: are there things you think should be possible in Matlab, but aren't? What things are possible with software packages similar to Matlab that Matlab would benefit from? (note that you can also submit an enhancement request through support, although I suspect they will be monitoring activity on this thread as well)
What should you post where?
Wishlist threads (#1 #2 #3 #4 #5): bugs and feature requests for Matlab Answers
Frustation threads (#1 #2): frustations about usage and capabilities of Matlab itself
Missing feature threads (#1 #2): features that you whish Matlab would have had
Next Gen threads (#1): features that would break compatibility with previous versions, but would be nice to have
@anyone posting a new thread when the last one gets too large (about 50 answers seems a reasonable limit per thread), please update this list in all last threads. (if you don't have editing privileges, just post a comment asking someone to do the edit)
Walter Roberson
Walter Roberson on 18 Oct 2023
I'm sure I mentiond this at some point... but it would be useful if you could substitute a logical index for more than one dimension.
For example:
img = imread('flamingos.jpg');
intens = rgb2gray(img);
mask = intens > 128;
newimg = img;
At this point, we would like to be able to use something like
%newimg(mask, 3) = 255 - img(mask, 3);
but that is not going to work, and instead we need to proceed something like
temp = img(:,:,3);
temp(mask) = 255 - temp(mask);
newimg(:,:,3) = temp;
subplot(2,1,1); image(img); title('original');
subplot(2,1,2); image(newimg); title('modified')
Now, there is a way to do it without a temporary variable, but it is ugly...
img = imread('flamingos.jpg');
intens = rgb2gray(img);
mask = intens > 128;
newimg2 = img;
newimg2(find(mask) + 2 * numel(mask)) = 255 - img(find(mask) + 2 * numel(mask));
figure;
subplot(2,1,1); image(newimg2); title('modified -- indexing')
isequal(newimg, newimg2)
ans = logical
1
dim-ask
dim-ask on 28 Aug 2023
An AI copilot feature-option in the IDE, where either matlab has their own model (optimal) with adjustable privacy that users can determine (to avoid possible gdpr etc issues), and/or the capacity to configure the copilot to work with an LLM service of our choice (also possibly run locally).
In the current state of afairs, continuing using an ide with no copilot integration is non-sustainable. Not for the future, for like yesterday. I already feel quite anxious falling behind compared to python users in terms of copilot language-specific support. There is a ton of python stuff out there that LLMs are trained on, and ime existing LLMs are worse in many other languages, including matlab. The direction copilots seem to get is different "specialised experts", and it seems finetuning different models to specific languages each has potential.
It would be great if Mathworks finetuned an LLM, which could, for example, either be some version of GPT3.5/4 that we could then use through an API, or a version of codellama that is (almost) open source that then mathworks itself could provide through an API (as an extra toolbox, or subscription, or whatnot). Or both options (why bet on one horse only?) or something else entirely. Also, it would be great if people who write matlab using other environments like neovim or vs-code had access to that model too. Even better if it is available for people to also run locally, like the codellama derivatives.
Finetuning a model should not be a great deal for a big company like mathworks, people with much less budget do this sort of thing nowadays. Mathworks has access to tons of matlab code they could use, and I cannot see anything putting any great obstacle to that apart from intention. There are a lot of companies and startups right now doing this sort of thing for other languages. But if mathworks does not do that with matlab, I don't know if anybody else will bother with it. So please consider offering something in that direction, because very soon it seems that writing code without option for copilot assistance will not be conceivable.
dim-ask
dim-ask on 29 Aug 2023
In some sense, you already deserved so even before.
Walter Roberson
Walter Roberson on 28 Aug 2023
I wonder if I will get any residuals for the various models that train on the numerous answers I have given? Somehow I suspect not...
Adam
Adam on 16 Feb 2023
When defining Abstract methods on a class, I would like to be able to fix the arguments on the abstract class.
Something like this would be usefull:
classdef AbstractSuperClass
methods (Abstract)
function AbstractMethod(self,input1,input2)
arguments
self
input1 (1,1) double
input2 (1,1) double
end
% no function body because it is abstract
end
end
end
Right now, I always end writing two versions of the same method to avoid the need to copy the arguments validation block to the subclass:
classdef AbstractSuperClass
methods
function Method(self,input1,input2)
arguments
self
input1 (1,1) double
input2 (1,1) double
end
abstract_version_of_method(self,input1,input2)
end
end
methods (Abstract,access=protected)
abstract_version_of_method(self,input1,input2)
end
end
but this feels wrong to do it and results in programming errors because I forget what the input signature of the method is, the above syntax would be more elegant and would allow for checking whether the input signature of the implementation of the method follows the definition in the abstract class.
With the new arguments (output), I would even be able to fix the output type of my abstract function
Andrew Janke
Andrew Janke on 17 Feb 2023
Oooh, tentative +1 on this. This is something I hadn't even thought of, and I'm not sure what all the implications of doing this in Matlab would be. But it's basically how traditional static OOP languages like Java and C++ work, and there it's obviously the right thing and we just take it for granted. There, the types etc of the input arguments are part of the interface or signature of those methods, and subclasses must conform to them, and that just makes things easy to reason about. (IMHO.)
dpb
dpb on 8 Feb 2023
I wish clearvars had an optional "do-nothing" flag a la the /L switch in CMD XCOPY to display the variable that would be cleared with the given variables list...would let one confirm a wildcard expression didn't accidentally wipe out something wished to have kept; particular with the -except clause.
Andrew Janke
Andrew Janke on 8 Feb 2023
Oooh, good idea. PowerShell does this for a bunch of their cmdlets like xcopy. I call this a "dry-run" or "what-if" run. I think PowerShell and recent Windows have standardized on the -WhatIf option for this.
Adam Danz
Adam Danz on 4 Jan 2023
Thanks for the lists of curated threads, @Rik!
dpb
dpb on 1 Jan 2023
Maybe there's a way I've not found, but I wish arrayfun and cellfun would have automagic argument expansion so one could pass other arguments to the anonymous function without having to replicate them manually to match the others. This would add greatly to the convenience in using either; the present working example happens to be building a set of target range expressions to stuff into a cell array that will be written to Excel although that really has nothing to do with the request/enhancement, just happens to be current time was frustrated that there's no way to pass constants to the anonymous functions to allow them to be generalized.
Example:
Building a variably-sized workbook where it is desirable that the sums over a section of the sheet be formulas rather than the current fixed constant value of the data as the sheet will subsequently be modified by hand; the tool is to build the original working pattern by compending various data sources and arranging for the end user...
It boils down to the point at which one has a set of row range indices and a set of columns over which to build the formula and insert into the cell array which is subsequently written to the workbook. That code looks something like
% anonymous function that builds Excel =SUM(r1:r2) expression for given row range, column
xlsSumRange=@(r1,r2,c)strcat('=SUM(',xlsAddr(r1,c),':',xlsAddr(r2,c),')');
% typical use
col=xlsCol2Col('G'); % another internal translation layer of local array position from Excel column
cOut(isTotal,col)=arrayfun(@(r1,r2,c)xlsSumRange(r1,r2,c),RS1,RS2,repmat('G',numel(RS)-1,1),'UniformOutput',0);
col=xlsCol2Col('K'); % another internal translation layer of local array position from Excel column
cOut(isTotal,col)=arrayfun(@(r1,r2,c)xlsSumRange(r1,r2,c),RS1,RS2,repmat('K',numel(RS)-1,1),'UniformOutput',0);
This works, but the expression "repmat('G',numel(RS)-1,1)" needed is really inconvenient and clutters up the code legibility greatly. I've had any number of similar case in the past where an anonymous function is useful shorthand but then to use more than once requires a workaround like the above.
The alternative is to redefine the anonymous function dynamically and embed the constant inside it for the given invocation.
To visualize, an example output for the above for one invocation looks like for the call with column 'G'
K>> arrayfun(@(r1,r2,c)xlsSumRange(r1,r2,c),RS1,RS2,repmat('K',numel(RS)-1,1),'UniformOutput',0);
ans =
3×1 cell array
{'=SUM($G$3:$G$17)' }
{'=SUM($G$22:$G$372)' }
{'=SUM($G$377:$G$414)'}
K>>
The above could be in a loop over the number of columns instead of using the explicit columns, but was part of still rearranging the output file structure at the time...and, haven't taken the time to clean it all up yet...
Andrew Janke
Andrew Janke on 4 Jan 2023
+1 on this, @dpb. This "implicit scalar expansion for (array|cell)fun args" is a use case I've had occasional cause to want, and haven't been able to figure out a good way to do, except for ditching arrayfun and Functional Programming style and inverting the logic/control-flow to just write a vectorized or "regular Matlab" version of the function I'm trying to do.
In other use cases, as long as I don't care about method-call overhead, I've been able to wrap the value to be expanded in an "infinite copies" array, like this SPAM thing here:
classdef SPAM
% "spam" a value to every element of an infinite virtual array
properties
Value
end
methods
function this = SPAM(x)
this.Value = x;
end
function out = subsref(this, S) %#ok<INUSD>
out = this.Value;
end
end
end
But that doesn't seem to work with cellfun/arrayfun, because it looks like they do an explicit "size(...)" test on their inputs before trying to index in to them.
>> x = magic(3);
>> z = arrayfun(@plus, x, SPAM(420))
Error using arrayfun
All of the input arguments must be of the same size and shape.
Previous inputs had size 3 in dimension 1. Input #3 has size 1
>> spam = SPAM(420);
>> z = NaN(size(x)); for i = 1:numel(z); z(i) = x(i) + spam(i); end
>> z
z =
428 421 426
423 425 427
424 429 422
>>
Can't say I blame Matlab for this, though. I like explicit size-conformity checks; catches bugs more often than it prevents features.
dpb
dpb on 2 Jan 2023
Thanks @Stephen23, @Bruno Luong and @Steven Lord for the feedback and example coding...I'll snag the code snippets and stuff away with the present code in a comment block and come back and revisit when some of the time pressure lessens...
Steven Lord
Steven Lord on 2 Jan 2023
You could avoid the need for 'UniformOutput' by using string arrays. I also changed xlsSumRangeCol to use string concatenation (with +) rather than strcat.
xlsAddr = @(r,c) sprintf("$%c$%d", c, r);
xlsSumRangeCol = @(c) @(r1,r2) "=SUM(" + xlsAddr(r1,c) + ":" + xlsAddr(r2,c) + ")";
c = 'G';
xlsSumRange = xlsSumRangeCol(c);
RS1 = 1:3;
RS2 = RS1+10;
arrayfun(xlsSumRange,RS1,RS2)
ans = 1×3 string array
"=SUM($G$1:$G$11)" "=SUM($G$2:$G$12)" "=SUM($G$3:$G$13)"
Or you could vectorize xlsSumRangeCol to eliminate the need for arrayfun.
xlsSumRangeCol = @(c) @(r1,r2) "=SUM($" + c + "$" + r1 + ":$" + c + "$" + r2 + ")";
xlsSumRange = xlsSumRangeCol(c);
xlsSumRange(RS1, RS2)
ans = 1×3 string array
"=SUM($G$1:$G$11)" "=SUM($G$2:$G$12)" "=SUM($G$3:$G$13)"
Or if you want the range to always be a certain number of elements long:
xlsSumRange1 = @(c, r1, n) "=SUM($" + c + "$" + r1 + ":$" + c + "$" + (r1+n) + ")";
xlsSumRange1(c, RS1, 10)
ans = 1×3 string array
"=SUM($G$1:$G$11)" "=SUM($G$2:$G$12)" "=SUM($G$3:$G$13)"
Bruno Luong
Bruno Luong on 2 Jan 2023
@dpb The whole point of TMW anymous function design is to be able to call it with only changing variables, and constant variable in the workspace is captured in the context without explicitly entered as input argument. This logic is tailored with arrayfun/cellfun, and other functions that requires function handles as input (fmincon and friends).
What you ask seems to be the contrary of this design logic., as @Stephen23 as pointed out.
Or if you want it properly you could cascade the anonymous functions as following
xlsAddr = @(r,c) sprintf('$%c$%d', c, r);
xlsSumRangeCol = @(c) @(r1,r2)strcat('=SUM(',xlsAddr(r1,c),':',xlsAddr(r2,c),')');
c = 'G';
xlsSumRange = xlsSumRangeCol(c);
RS1 = 1:3;
RS2 = RS1+10;
arrayfun(@(r1,r2)xlsSumRange(r1,r2),RS1,RS2,'UniformOutput',0)
ans = 1×3 cell array
{'=SUM($G$1:$G$11)'} {'=SUM($G$2:$G$12)'} {'=SUM($G$3:$G$13)'}
Admitly the 'Uniform' argument does look ugly and for-loop is much more readable.
dpb
dpb on 2 Jan 2023
Possibly, Walter.
In the end I gave up the arrayfun syntax entirely in this application because there are M rows and N ranges per row over which to build a compound Excel range so the number of elements in the argument list isn't the same and the complexity just got to be too much.
So, I ended up reverting to a doubly-nested loop using the direct sprintf() form for each combination and then join'ed them in the end to pass to Excel COM instruction...sometimes we fall into the trap of trying to remove explicit loops too often.
But, I STILL think the idea has merit...there have been a number of times I'd really, really like to have been able to have done.
Walter Roberson
Walter Roberson on 1 Jan 2023
I wonder if string operations would be faster these days?
xlsSumRange = @(r1,r2)"=SUM(" + xlsAddr(r1,c) + ":" + xlsAddr(r2,c) + ")");
in which case you would not need 'UniformOutput', 0 directly because string arrays are a thing. (On the other hand you cannot store a string array into a scalar location.)
dpb
dpb on 1 Jan 2023
Somehow I developed an aversion to redefining the function to parameterize; I guess on due consideration it would be the way to simplify with current syntax. Thanks for the prod, @Stephen23...but, I still think the suggestion would be a worthwhile extension to the [array/cell]fun syntax.
Stephen23
Stephen23 on 1 Jan 2023
This just boils down to function parameterization, which is indeed simpler and more efficient:
c = 'G';
xlsSumRange = @(r1,r2)strcat('=SUM(',xlsAddr(r1,c),':',xlsAddr(r2,c),')');
% typical use
col = xlsCol2Col(c);
cOut(isTotal,col) = arrayfun(xlsSumRange,RS1,RS2, 'UniformOutput',0);
Replacing STRCAT with SPRINTF would also be more efficient:
xlsSumRange = @(r1,r2) sprintf('=SUM(%s:%s)',xlsAddr(r1,c),xlsAddr(r2,c));
dpb
dpb on 27 Nov 2022
read/writetable from/to Excel workbooks should be able to return/write the comment (now called something else, I forget what) field and the formula associated with the cell as well as the value. While one can write COM to do so, it then takes either using COM entirely (can be a lot of work) or have to use both high-level and COM on the same file; either of which options isn't ideal. Sure, one could forego Excel entirely since have MATLAB, but unfortunately can't always have what we want in that regards.
One can mung on the old xlsread/write routine and add stuff into it, but it's also kinda' klunky and while more convenient in some ways as compared to writing all COM totally from scratch isn't nearly as convenient as would be a higher-level interface with the other current toolset.
There's a hook to a function call in xlsread although I was never able to get it to work to do either of the above; because the Excel COM object isn't exposed to the function to be able to make direct access from that function.
cui,xingxing
cui,xingxing on 12 Mar 2022
DGM
DGM on 11 Mar 2022
I'm going to be a weirdo and say that I would like it if imshow() supported IA and RGBA inputs. I'm probably the only person who ever uses RGBA workflows in MATLAB, but these are wishes we're talking about. I might as well wish for a function that gives me a sandwich.
I already made my own tool for MIMT, but it kind of drives me up the wall to not be able to use all the conveniences I created when answering questions on the forum. I feel like I'm defeating myself.
Bruno Luong
Bruno Luong on 27 Oct 2021
Probably it breaks compatibility, but it would make functions/operators svd, *, ', .' dealing with n-d arrays similar to pagesvd, pagemtimes, ... followed by appropriated reshape.
Extend the pagexxx with matrix left/right division, lu, qr, chol, eig, etc...
Bruno Luong
Bruno Luong on 9 Feb 2023
@Adam Not only the floating point rounding can create different numerically result, but what matters even more is that the floating point counts when multiply matrices can be different.
Consider the product
A*B*x
with
  • A: p x m,
  • B: m x n,
  • x: m x 1
with p = 100, n = 100, m = 1000,
It is much cheaper to perform
A*(B*x) than (A*B)*x.
And in general the less operations is carried out, the less round-off has effect on the final result.
Adam
Adam on 9 Feb 2023
Ah, that's the thing I was missing, thanks for clarifying that
Stephen23
Stephen23 on 9 Feb 2023
@Adam: binary floating point addition and multiplication are not associative:
This means the order matters.
Adam
Adam on 9 Feb 2023
I don't really understand why associativity control is important.
Is the result not the same for both cases?
Maybe I'm missing something.
Bruno Luong
Bruno Luong on 2 Jan 2023
Good idea
pagemtimes(A,B,C)
User should be able somehow to control the associativity, meaning equivalent to
pagemtimes(A,pagemtimes(B,C))
or
pagemtimes(pagemtimes(A,B),C)
Adam
Adam on 2 Jan 2023
I really find these page functions very usefull. Some usefull additions in my opinion would be:
Have the option to multiply more than two matrices with pagemtimes
I now always end up writing pagemtimes(A,pagemtimes(B,C)). It would be very usefull to be able to write pagemtimes(A,B,C) in the future for the readability of the code.
Paged version of decomposition
The decomposition is also a usefull tool and would be nice to have a page version of it available
Bruno Luong
Bruno Luong on 22 Sep 2022
Thank you Steve, and also to the dedicated developpers.
Steven Lord
Steven Lord on 22 Sep 2022
We only added one page function in release R2022b. It's not on your list, but you might find pagenorm useful.
Bruno Luong
Bruno Luong on 11 Mar 2022
Hi Steve, the priority remains in this order to me. Thanks
Steven Lord
Steven Lord on 10 Mar 2022
The pagemldivide, pagemrdivide, and pageinv functions are new as of release R2022a. We also have several other page* functions (including all but one of the items in your top 4 levels, we don't have a pageeig function) as shown in the functions list.
So does your list still start with pageeig or have one of the items at a lower level jumped ahead of it in your prioritization?
Bruno Luong
Bruno Luong on 28 Oct 2021
Priority in term of usefullness IMO should be
  1. pagetranspose, pagectranspose
  2. pagemtimes
  3. pagemrdivide (pagemldivide can just be a wrapparound), but as mrdivide is based on qr factorization, interm of dev I guess TMW woul need to make dave of pageqr first.
  4. pagesvd, pageeig
  5. pageqr, pagelu, pagechol
  6. pageldl
  7. pageexpm
  8. pagehess, pageqz, pageschur
  9. pageinv, pagetrace, pagedet
Steven Lord
Steven Lord on 28 Oct 2021
You've listed a bunch of functions there. Out of curiosity, if you had to prioritize which additional functions would you like to see get the pagemtimes, pagetranspose, pagectranspose, and pagesvd treatment first? What would be your top say half a dozen?
gwoo
gwoo on 26 Oct 2021
Being able to access the properties/methods/fields of an object/struct even after indexing into one would be a big deal.
Currently, if you have a struct A, with fields size and count, you could do A. then tab to show the options for the fields. But if you do A(1). you cannot now tab to show the options for the fields. Same with an object. So the discoverability is gone.
I want to be able to index into an object/struct and still have the available fields/properties/methods for that parent show up.
Paul
Paul on 27 Oct 2021
I just tried this on 2020b and hitting tab after A(1). showed the fields.
Mario Malic
Mario Malic on 27 Oct 2021
+1 on this: Currently, if you have a struct A, with fields size and count, you could do A. then tab to show the options for the fields. But if you do A(1). you cannot now tab to show the options for the fields. Same with an object. So the discoverability is gone.
Jim Svensson
Jim Svensson on 24 Oct 2021
Maintain dimensions when getting a field of a class.
If Data is a 3x2x4 array of objects/structs with a field "foo", then Data.foo should be an 3x2x4 array of the type of "foo". Not a 1x24 array, or is it the other way around.
Jim Svensson
Jim Svensson on 24 Oct 2021
Yes you are right, now I remember. Always have to do something like "foo = [Data.foo]".
Rik
Rik on 24 Oct 2021
It currently is neither: it's a comma separated list.
for i1=1:3,for i2=1:2,for i3=1:4,s(i1,i2,i3).Data=rand;end,end,end
s.Data
ans = 0.9787
ans = 0.5449
ans = 0.2691
ans = 0.9030
ans = 0.7619
ans = 0.5311
ans = 0.8777
ans = 0.5484
ans = 0.2540
ans = 0.7540
ans = 0.6646
ans = 0.9153
ans = 0.6058
ans = 0.2581
ans = 0.6459
ans = 0.4237
ans = 0.1189
ans = 0.1992
ans = 0.3687
ans = 0.4382
ans = 0.7179
ans = 0.2574
ans = 0.5783
ans = 0.1151
To do something with it you'll have to capture it with [] or {} or a function that allows arbitrary input.
Image Analyst
Image Analyst on 24 Oct 2021
I agree. Makes intuitive sense to me and would be convenient for extracting foo.
Jim Svensson
Jim Svensson on 24 Oct 2021
Fix the semantics of "clear".
"clear all" does not clear all, but "clear classes" does. Go figure. I want a way to clear classes and only classes.
Jim Svensson
Jim Svensson on 24 Oct 2021
Clear also cannot clear specific classes in different packages if they have the same name. I.e. pkg1.my_class, and pkg2.my_class. Matlab's package system is broken, but at least some things could be improved.
Michael Foote
Michael Foote on 20 Oct 2021
In the code analyzer, there is no easy way to find what #ok directive controls a particular flagged issue.
(And no overall list of the available #ok directives, at least that I can find. Even the enable/disable messages in preferences don't show them.)
Steven Lord
Steven Lord on 22 Sep 2022
Perhaps the codeIssues function introduced in release R2022b will be of use to you. The CheckID variable in the issues table stored in the codeIssues object is the identifier you'd use in the %#ok pragma to suppress Code Analyzer's reporting of that particular issue.
Rik
Rik on 21 Oct 2021
Maybe I've only looked in the wrong places, but the changes from release to release about what is marked as a warning by mlint are poorly (or not) documented in the release notes.
So there are more things leaving room for improvement regarding this.
Iuliu Ardelean
Iuliu Ardelean on 5 Oct 2021
I would like imagesc(C) to work with 3 dimensional arrays.
Walter Roberson
Walter Roberson on 5 Oct 2021
vol 3d v2 in File Exchange.
See also the code I posted in https://www.mathworks.com/matlabcentral/answers/1447449-how-to-draw-a-volxe-size#comment_1728709 about a month ago, which creates voxel cubes (taking care that each one has proper face orientation so normals can be calculated).
The disadvantage of the code I posted is that it builds a cube for each voxel, instead of trying to merge together adjacent voxels to reduce the drawing cost. Drawing one cube for each voxel has advantages if you want to be able to use per-voxel alphadata (since two adjacent cubes with exactly the same "value" attribute might potentially be assigned different alpha.
The code I posted there only draws cubes for "occupied" voxels. Which reduces drawing costs, but leads to questions about the best way to create alpha data -- do you create the alpha data as a cuboid that occupies the full possible space, or do you create the alpha data in a way that maps only to the occupied locations?
Iuliu Ardelean
Iuliu Ardelean on 5 Oct 2021
Sorry about the name typo.
Rik
Rik on 5 Oct 2021
Since it is a very different goal, why should it have the same name? I'm a firm advocate for the concept that a function should do one Thing. What constitutes a Thing can of course be flexible, but in this case 2D and 3D are different enough that they would require different tools.
Have you looked at the File Exchange for 3D viewers? There are many of them. One might already do what you want. I don't recall any built-in function that will directly do this. The colors are simply based on the current colormap, so that should be easy enough to implement.
Also, next time you use your phone to answer here, double check the spelling of the name of the person you're replying to.
Iuliu Ardelean
Iuliu Ardelean on 5 Oct 2021
Hi Rik. I would use it as a volumetric viewer as you say. I would pass a 3D array to imagesc (or you can call it something else) and it would be able to plot 3D little cuboids, instead of 2D faces it plots now. The cubes would be colored based on the values stored in the array, in the same way imagesc works now. Maybe I would also use AlphaData to make some of the little cuboids transparent based on what I am interested in.
Rik
Rik on 5 Oct 2021
What should the behavior be? Why aren't you using a dedicated volumetric viewer for volumetric data? And if you're talking about RGB-images, what would be the point of using imagesc instead of image (or the high-level imshow)?
Valeri Aronov
Valeri Aronov on 31 Aug 2021
Your TypicalX option for fminunc() (and others?) should be extended beyond usage for gradient evaluation only.
I have used normalized variables for optimization for a long time. By default, I do start with [1,1,...,1] as you do, but for gradient evaluation only. There are many areas where a spread of variables is vast (radiolectronics: kiloohms to nanofarads).
Walter Roberson
Walter Roberson on 10 Aug 2021
Currently evalin() accepts a context argument (such as 'caller' or 'base' or symengine()), and a character vector that is the command to be executed.
This runs into the same horrors as using eval() .
It is difficult to convince people to give up using eval(); they tend to think that their particular use case makes it necessary (it rarely is!). And the cause is Not Helped At All when we have to say "well, it is true that the closely-related "evalin() is needed sometimes"
It would therefore help if there was a way to do something like evalin() but with a function handle. For example,
evalin('caller', 'whos')
might become something like
evalfcnin('caller', @whos)
To be honest, I do not know how this would work in practice, considering that functions need their own workspace to execute in. Maybe some of the technology behind shared variables and nested functions could be used, so that the function could have read/write access to the designated function workspace and yet still be able to have its own private variables.
Sometimes I want to be able to get a look at persistent variables in a function that is not the caller; I have never found a hint that is possible. But the existence of persistent variables that go away when you "clear" the function, implies that each parsed function already has some kind of workspace associated with it. And sometimes it seems to me that it would be useful if you were able to get a referene to that workspace and tell a function to execute using that workspace. Something that might look like
evalinWorkSpace( matlab.workspace.getinstance.caller, @whos)
Having workspaces as accessible objects leads to some interesting possibilities about saving and restoring state, such as for the purpose of recovering from power failures; it also heads towards possibilities such as co-routines.
James Tursa
James Tursa on 11 Mar 2022
@Paul In your last example, a shared-data-copy of d is passed into func( ). Inside the function, when b gets modified, is when a deep copy gets made.
Paul
Paul on 27 Oct 2021
Pass-by-reference would allow direct modification of the data, but it's my understanding that, in general, Matlab doesn't allow direct modification of the data (with one exception that I know of). So in a function such as this
c = func(d)
function a = func(b)
a = 2*b
end
the computation of a operates on the same data that is addressed by d in the caller's workspace. So even though func doesn't directly modify d, we still get the advantage of not having to create and delete a copy.
But in this situation
c = func(d)
function a = func(b)
b = 2*b;
a = b
end
the input to func is passed-by-value, i.e., a copy of d is passed into func and then deleted when func completes executing.
Is my understanding of the basic mechanisms for passing data in to functions incorrect?
Walter Roberson
Walter Roberson on 27 Oct 2021
pass-by-reference, "where the parameter in the callee becomes an alias to the variable in the caller's workspace" allows direct modification of the data .
Consider for example the C call setup. You can pass numeric scalars by value. You can pass struct (themselves) by value. But when you pass a vector or array, what gets passed is the address, not a copy of the content. If the called function does not declare "const" then it is permitted to use the pointer to modify the original data in-place.
Paul
Paul on 27 Oct 2021
I thought Matlab uses pass-by-reference unless the parser determines that the receiving function modifeds the input argument?
Andrew Janke
Andrew Janke on 27 Oct 2021
For doing this sort of thing, I like to lean on the correspondence between workspaces and structs: both are a collection of name/value pairings, and support the same set of valid identifiers for variable names or field names. Package a workspace state up into a struct, pass it to a function that takes a struct input, unpackage that struct into the callee function's workspace, and work with them there, pass the results as a struct, and then optionally unpackage them in the caller's workspace. I use a pair of vars2struct and struct2vars helper functions to do this.
function foo()
x = 42;
y = "something";
% One-way exchange:
bar(vars2struct);
% Round-trip exchange, modifying original caller's variables:
struct2vars(baz(vars2struct));
end
function out = bar(s)
struct2vars(s);
out = sprintf('x=%d, y=%s', x, y);
end
function out = baz(s)
struct2vars(s);
x = x + 3;
y = y + " more";
out = vars2struct;
end
This might be a little cleaner than granting a function direct access to another function call's workspace. Cross-stack-frame operations can get messy. And it gives you nice "transactional" behavior, where either all or none of the work in the child function gets done.
But I don't think it supports coroutines.
Adding true pass-by-reference function arguments (where the parameter in the callee becomes an alias to the variable in the caller's workspace) to Matlab could be another way of handling this. Though I don't know if that's a good idea: then you get shared mutable state in ways that aren't always obvious from looking at the function call site, and takes you further away from Matlab's pass-by-value, sort-of-functional-programming paradigm.
Here's the helper functions:
I think it might be cool and useful for debugging, but tempting and dangerous, to have dbstack include the workspaces of each stack frame in its output.
Image Analyst
Image Analyst on 29 Jul 2021
I'd like questdlg() to be able to take more than 3 buttons.
Often I need 4 buttons, like "Yes", "No", "Cancel", and "All", like if I'm looping over files in a listbox asking if you want to delete them or not. Why can't questdlg() take any number of arguments, much like other functions like ones(), and just put up the buttons in a dialog box in an array? The last argument could be the button that you'd like for the default (as it is now).
I know I can still use menu() but it's deprecated in favor of listdlg() and I'd rather have buttons than a listbox - it's just more intuitive.
Steven Lord
Steven Lord on 22 Sep 2022
If you're using uifigure objects you can create a uiconfirm object for your uifigure. This code won't run in MATLAB Answers but it will in MATLAB Online or desktop MATLAB.
f = uifigure;
y = uiconfirm(f, 'Select an option', 'Option Selector', ...
Options=["Yes", "No", "Cancel", "All"])
cui,xingxing
cui,xingxing on 10 Jun 2021
Adaptive specification of feature map output size:
Single and multi-objective vision tracking algorithms:
KCF, GOTURN, FairMOT, deepSort ,... are some of the best and successful algorithms in recent years, but unfortunately, why is there no such implementation in the "sensor fusion and tracking toolbox", "deeplearning toolbox" and "computer vision toolbox"?
loss functions for time series prediction:
The current deep learning toolbox is missing loss functions for time series prediction, e.g. "DTW, Soft-DTW, DILATE" loss, and although the signal processing toolbox has a dtw function, it does not support dlarray type data input?
Video reading and processing
The latest version of R2021a only supports fileDatastore/videoReader etc. to load various video datasets, and the read IO bottleneck is very inefficient and lacks a decord-like library for efficient video processing
Bayesian Deep Learning Convolution Network(BDL),Bayesian Neural Network(BNN)
Binary Neural Networks
Does current matlab 2021a deeplearning toolbox support Binary Deep Neural Networks (BNN)? How is it trained and compressed? If not, will future versions integrate this feature? thanks
reference:
cui,xingxing
cui,xingxing on 18 Aug 2021
@Adam Danz,Thank you for your useful advice!This is another indication that matlab is very good, not the latest, but the most robust and reliable algorithm integration!
Adam Danz
Adam Danz on 13 Aug 2021
@cui your suggestions are imaginative, specific, and I'm sure it's valuable to the company to see what users would like. It would be even more helpful to include a comparison to existing features that come close to achieving your suggestions. I'm not an employee of MathWorks nor am I speaking for them, this is just my opinion.
For example, there are already object tracking algorithms available in Matlab (see computer vision toolbox). At the current pace of technology, algorithms are created much faster than the pace of development, especially for companies like MathWorks that must thoroughly test for backward compatibility and redundancy. This is where the File Exchange often comes in handy to fill in the gaps. By listing every possible missing algorithm, the SNR of focal points for future releases becomes weaker. That could be strengthened by including arguments for why a new feature is needed rather than just listing missing features.
Robert Guldi
Robert Guldi on 29 May 2021
As far as I can tell, there does not seem to be very much in the ways of documentation for Excel-based work (i.e creating and manipulating charts). I'd love to see some of this material added into the Documentation search if at all possible.
dpb
dpb on 2 Jun 2021
OK, thanks for the hint -- I had thought that
borders=get(theCell, 'Borders');
theBorder=get(borders, 'Item', border);
set(theBorder,'LineStyle', style,'Weight',weight);
would have returned the wanted border Item object, but apparently not...I still don't fully understand that, but the following does work....
theBorder=borders.Item(whichBorder);
set(theBorder,'LineStyle', style,'Weight',weight);
although one apparently can't write
set(borders.Item(whichBorder),'LineStyle', style,'Weight',weight);
in typical MATLAB syntax fashion.
function SetBorder(sheetReference, ranges, whichBorder, weight, style)
if style==XlLineStyle.xlDouble, weight=XlBorderWeight.xlThick; end % only combination that works
if ischar(ranges), ranges=cellstr(ranges); end
if isenum(whichBorder), whichBorder=int32(whichBorder); end
if isenum(weight), weight=int32(weight); end
if isenum(style), style=int32(style); end
for i=1:numel(ranges)
try
range=sheetReference.Range(ranges{i});
borders=get(range, 'Borders');
theBorder=borders.Item(whichBorder);
set(theBorder,'LineStyle', style,'Weight',weight);
catch ME
fprintf('Error in function SetBorder.\nError Message:\n%s\n', ME.message)
%warning('Error in function SetBorder.\n%s', ME.message)
end
end
end
Experimentation also revealed that one can't use any combination of the enumerations (which limitation is also NOT documented). Only with the "Thick" weight is a double-line rendered; all the others are a single line of medium weight.
All kinds of things aren't documented and left for only trial and error to uncover...
The above could be cleaned up and forget about trying to use enumerations, but it's expedient for the moment and there are far more important issues to fix rather than continuing to throw time down the rat hole...
Thanks, you did get me pointed to what can be made to work--muchly appreciated!!
dpb
dpb on 2 Jun 2021
So whassup w/
% 9 - xlEdgeBottom Border at the bottom of the range
in the doc enumerations and nothing listed for 1 thru 4???
This still makes no sense to me whatsoever...
I'm in the middle of another debug session at moment so will check again but I tried a loop of 1:N before and still had no joy I'm pretty sure...
Thanks for the feedback; will report.
Mario Malic
Mario Malic on 2 Jun 2021
borders.Item(1).LineStyle = -4119 will give you double line on one border, I think the right one. Bottom border is one of Item between 2 and 4 so check those.
Paul
Paul on 2 Jun 2021
I'm quite sure I won't be able to offer any help. I was just curious. But I feel your pain having dabbled with doing much simpler mucking around in PowerPoint from Matlab.
dpb
dpb on 2 Jun 2021
Oh, here's the generic routine I tried to write, taken from Image Analyst's utilities package that illustrated some specific choices rather than being general. You'll see the kludge to get around the MATLAB enumeration problem--I had built those classes as a user aid to be able to see the constants instead of having to look them up or have in comments or bury magic constants in source code. That proved to be, so far, an almost pointless exercise, too.
function SetBorder(sheetReference, ranges, border, weight, style)
% borders is a collections of all cell borders. Must set each.
%
% my_border = get(borders, 'Item', XlBordersIndex);
% set(my_border, 'ColorIndex', 3);
% set(my_border, 'LineStyle', 9);
%
% Excel XlBordersIndex Enumeration
% 5 - xlDiagonalDown UL diagonal down to LR
% 6 - xlDiagonalUp LL diagonal up to UR
% 7 - xlEdgeLeft Border at the left edge of the range.leftmost only
% 8 - xlEdgeTop Border at the top of the range.
% 9 - xlEdgeBottom Border at the bottom of the range.
% 10 - xlEdgeRight Border at the right edge of the range.
% 11 - xlInsideVertical Vertical borders for all the cells in the range except borders on the outside of the range.
% 12 - xlInsideHorizontal Horizontal borders for all cells in the range except borders on the outside of the range.
%
% Excel XlBorderWeight Enumeration
% Specifies the weight of the border around a range.
% Name Value Description
% xlHairline 1 Hairline (thinnest border).
% xlMedium -4138 Medium.
% xlThick 4 Thick (widest border).
% xlThin 2 Thin.
%
% Excel XlLineStyle Enumeration
% Specifies the line style for the border.
% Name Value Description
% xlContinuous 1 Continuous line.
% xlDash -4115 Dashed line.
% xlDashDot 4 Alternating dashes and dots.
% xlDashDotDot 5 Dash followed by two dots.
% xlDot -4118 Dotted line.
% xlDouble -4119 Double line.
% xlLineStyleNone -4142 No line. (Alias xlNone)
% xlSlantDashDot 13 Slanted dashes.
if ischar(ranges), ranges=cellstr(ranges); end
if isenum(border), border=int32(border); end
if isenum(weight), weight=int32(weight); end
if isenum(style), style=int32(style); end
for i=1:numel(ranges)
try
theCell=sheetReference.Range(ranges{i});
borders=get(theCell, 'Borders');
thisBorder=get(borders, 'Item', border);
set(thisBorder,'LineStyle', style,'Weight',weight);
catch ME
fprintf('Error in function SetBorder.\nError Message:\n%s\n', ME.message)
%warning('Error in function SetBorder.\n%s', ME.message)
end
end
end
It also has the aforementioned bizarre behavior that the warning line is totally ineffective -- I just thought about the fact this routine is still a static method in a class having kept the organization IA had posted. Haven't tested whether moving it into its own m-file would fix that problem--good guess it might I think. Although I couldn't find anything to that end in the MATLAB doc, either.
dpb
dpb on 2 Jun 2021
Paul/Mario -- thanks for taking an interest... :) I really didn't expect anybody to delve into this; I was just frustrated and ranting...
Here's the little testing routine I wrote thinking if I manually set some borders in a spreadsheet I could then retrieve what was in the cells and use that to figure out what should write -- needless, to say, I left more confused than I came--
function GetBorderInfo(sheetReference, ranges)
% return borders collection info for range given
if ischar(ranges), ranges=cellstr(ranges); end
for i=1:numel(ranges)
try
theCell=sheetReference.Range(ranges{i});
borders=get(theCell, 'Borders');
nBorders=boarders.Count;
thisBorder=get(borders, 'Item', border);
set(thisBorder,'LineStyle', style,'Weight',weight);
catch ME
fprintf('Error in function SetBorder.\nError Message:\n%s\n', ME.message)
%warning('Error in function SetBorder.\n%s', ME.message)
end
end
end
I opened the ActiveX session first, then used
GetBorderInfo(wksht,'D2')
and then poked around in the debugger trying to figure out what was what.
I did recognize the problem line so set the breakpoint at the beginning of the
thisBorder=get(borders, 'Item', border);
line and then did all my poking around in the debugger. I just got so frustrated I never tried to fix the code but just gave it up as lost cause and wasted day.
If you look at the doc for enumerations
the values are
Name Value Description
xlContinuous 1 Continuous line.
xlDash -4115 Dashed line.
xlDashDot 4 Alternating dashes and dots.
xlDashDotDot 5 Dash followed by two dots.
xlDot -4118 Dotted line.
xlDouble -4119 Double line.
xlLineStyleNone -4142 No line.
xlSlantDashDot 13 Slanted dashes.
but any value I tried to write other than 1 or -4142 returned the error and didn't set the line style desired, but I did, in fact see the value -4119 returned from poking around after I had manually set and save the cell border in cell D2 of the test workbook.
I guess the thing about " If you set borders.LineStyle to some value, 1-4 are set" explains why the enumerations begin at 5 although if that is documented anywhere, I've not been able to find it, nor do any examples mention the fact.
So, what I wanted was a bottom double line of either thin or medium width...but tried to write a generic routine to be able to set any as desired.
It worked/works for a continuous line, but nothing else...gets what appears a random selection of continusous or various dotted/dashed, etc., but never a double to be seen no matter what I tried to write.
It's also not documented what the expected type of the values passed is to be; afaict by symptoms, MATLAB set() converts any native numeric to whatever internally although as the other Q? I posted notes (to which there's been no response so far) the MATLAB enumeration type seems to actually pass some object, not the equivalent value as value as one would expect an enumeration should/would do. That's just rude!!!
Anyways, any further light you can shed would be greatly appreciated, but I remain in the camp believing that writing ActiveX to interact with Excel is worse than having root canal without anesthesia...
Paul
Paul on 1 Jun 2021
Where in your code is the variable borders defined, as used in this line?
nBorders=borders.Count
Where did you see this line?
thisBorder=get(borders, 'Item', border);
Mario Malic
Mario Malic on 1 Jun 2021
I hope I understood what you wanted to do.
This line is not good.
thisBorder=get(borders, 'Item', border);
Try this
theCell=sheetReference.Range(ranges{i});
borders=get(theCell, 'Borders'); % borders return the borders that are bounded by range Items(1:4), where 5:6 are diagonals
set(borders,'LineStyle', style,'Weight',weight);
There are some weird things of course which are misisng from the documentation. borders.Count returns 6, borders.Items go to 12 (probably when selection is 2D). If you set borders.LineStyle to some value, 1-4 are set.
dpb
dpb on 1 Jun 2021
Maybe you've found " their methods and properties are described meaningfully and it can be easy to narrow down the search" to be the case, but my experience has not been so fortunate. Maybe you have enough familiarity with the object model that you can figure out how to make a Range or Cell or whatever reference to whatever it is you're looking for work, but I'm continually fight the battle of just how to get to the property of interest when it's in some collection of somethings underneath the cell or range or whatever...
I spent all day yesterday in pursuit of how to set borders programmatically and came up empty -- stuff that is documented just doesn't work or I can't figure out how to use it--another frustration I discovered raised the following Q?
and the follow-ons to the template code I used as starting point at
If one tries to use the Xl enumerated constants to set the border line styles, Excel barfs...but if you set a given border interactively and then try retrieve the value of the constant from the saved workbook, it looks to be that same value. Whassup with that!!!??? I finally gave up in frustration as has been my luck about as much as not for anything outside just writing data.
If you can make heads nor tails of the Borders collection documentation, you're a better maven than I...I have no klew from it how it is constructed and what it means to get a Count == 6 when the doc says it is a collection of four??? And the enumerations go to 15 or so??? Makes zero sense to me.
>> excel=actxserver('Excel.Application');
>> wbk=excel.Workbooks.Open(fullfile(cd,'Testing.xlsx'));
>> wksht=Excel_utils.sheetReference(excel,1)
wksht =
Interface.000208D8_0000_0000_C000_000000000046
K>> get(sheetReference.Range("A1").Borders,'LineStyle')
ans =
NaN
K>> get(sheetReference.Range("D2").Borders,'LineStyle')
ans =
NaN
K>> nBorders=borders.Count
nBorders =
6
K>> get(borders)
Application: [1×1 Interface.000208D5_0000_0000_C000_000000000046]
Creator: 'xlCreatorCode'
Parent: [1×1 Interface.00020846_0000_0000_C000_000000000046]
Color: 0
ColorIndex: -4142
Count: 6
LineStyle: NaN
Value: NaN
Weight: NaN
ThemeColor: NaN
TintAndShade: NaN
K>>
K>> borders
borders =
Interface.00020855_0000_0000_C000_000000000046
K>> borders.Count
ans =
6
K>> borders(1)
ans =
Interface.00020855_0000_0000_C000_000000000046
K>> borders(2)
Index exceeds the number of array elements (1).
K>>
% OK, so it's not an array of borders of nCount
K>> for i=1:nBorders,get(b,'item',i),end
ans =
Interface.00020854_0000_0000_C000_000000000046
ans =
Interface.00020854_0000_0000_C000_000000000046
ans =
Interface.00020854_0000_0000_C000_000000000046
ans =
Interface.00020854_0000_0000_C000_000000000046
ans =
Interface.00020854_0000_0000_C000_000000000046
ans =
Interface.00020854_0000_0000_C000_000000000046
K>>
% OK, so whatever an Item is, there are six of those???
K>> for i=1:nBorders,b=get(borders,'item',i),get(b),end
b =
Interface.00020854_0000_0000_C000_000000000046
Application: [1×1 Interface.000208D5_0000_0000_C000_000000000046]
Creator: 'xlCreatorCode'
Parent: [1×1 Interface.00020846_0000_0000_C000_000000000046]
Color: 0
ColorIndex: -4142
LineStyle: -4142
Weight: 2
ThemeColor: NaN
TintAndShade: NaN
b =
Interface.00020854_0000_0000_C000_000000000046
Application: [1×1 Interface.000208D5_0000_0000_C000_000000000046]
Creator: 'xlCreatorCode'
Parent: [1×1 Interface.00020846_0000_0000_C000_000000000046]
Color: 0
ColorIndex: -4142
LineStyle: -4142
Weight: 2
ThemeColor: NaN
TintAndShade: NaN
b =
Interface.00020854_0000_0000_C000_000000000046
Application: [1×1 Interface.000208D5_0000_0000_C000_000000000046]
Creator: 'xlCreatorCode'
Parent: [1×1 Interface.00020846_0000_0000_C000_000000000046]
Color: 0
ColorIndex: -4105
LineStyle: 4
Weight: -4138
ThemeColor: 'Invoke Error, Dispatch Exception: The parameter is incorrect.←↵'
TintAndShade: 0
b =
Interface.00020854_0000_0000_C000_000000000046
Application: [1×1 Interface.000208D5_0000_0000_C000_000000000046]
Creator: 'xlCreatorCode'
Parent: [1×1 Interface.00020846_0000_0000_C000_000000000046]
Color: 0
ColorIndex: -4105
LineStyle: -4119
Weight: 4
ThemeColor: 'Invoke Error, Dispatch Exception: The parameter is incorrect.←↵'
TintAndShade: 0
b =
Interface.00020854_0000_0000_C000_000000000046
Application: [1×1 Interface.000208D5_0000_0000_C000_000000000046]
Creator: 'xlCreatorCode'
Parent: [1×1 Interface.00020846_0000_0000_C000_000000000046]
Color: 0
ColorIndex: -4142
LineStyle: -4142
Weight: 2
ThemeColor: NaN
TintAndShade: NaN
b =
Interface.00020854_0000_0000_C000_000000000046
Application: [1×1 Interface.000208D5_0000_0000_C000_000000000046]
Creator: 'xlCreatorCode'
Parent: [1×1 Interface.00020846_0000_0000_C000_000000000046]
Color: 0
ColorIndex: -4142
LineStyle: -4142
Weight: 2
ThemeColor: NaN
TintAndShade: NaN
K>>
% But some show an error, but no indication of which parameter it thinks is
% incorrect...
% The Xlborder enumeration for bottom line is 9, though, which is >6, but
% it also returns something that is, the value I tried to write of -4119
% which is supposed to be a double line by the enumerations values in the
% documentation???
K>> b=get(borders,'item',9)
b =
Interface.00020854_0000_0000_C000_000000000046
K>> get(b)
Application: [1×1 Interface.000208D5_0000_0000_C000_000000000046]
Creator: 'xlCreatorCode'
Parent: [1×1 Interface.00020846_0000_0000_C000_000000000046]
Color: 0
ColorIndex: -4105
LineStyle: -4119
Weight: 4
ThemeColor: 'Invoke Error, Dispatch Exception: The parameter is incorrect.←↵'
TintAndShade: 0
K>> set(b)
ans =
struct with fields:
Application: {}
Creator: {'xlCreatorCode'}
Parent: {}
Color: {}
ColorIndex: {}
LineStyle: {}
Weight: {}
ThemeColor: {}
TintAndShade: {}
K>>
K>> get(b)
Application: [1×1 Interface.000208D5_0000_0000_C000_000000000046]
Creator: 'xlCreatorCode'
Parent: [1×1 Interface.00020846_0000_0000_C000_000000000046]
Color: 0
ColorIndex: -4105
LineStyle: 1
Weight: -4138
ThemeColor: 'Invoke Error, Dispatch Exception: The parameter is incorrect.←↵'
TintAndShade: 0
K>> set(b,'ThemeColor',1)
K>> get(b)
Application: [1×1 Interface.000208D5_0000_0000_C000_000000000046]
Creator: 'xlCreatorCode'
Parent: [1×1 Interface.00020846_0000_0000_C000_000000000046]
Color: 16777215
ColorIndex: 2
LineStyle: 1
Weight: -4138
ThemeColor: 1
TintAndShade: 0
K>> set(b,'LineStyle',-4119)
K>> get(b)
Application: [1×1 Interface.000208D5_0000_0000_C000_000000000046]
Creator: 'xlCreatorCode'
Parent: [1×1 Interface.00020846_0000_0000_C000_000000000046]
Color: 16777215
ColorIndex: 2
LineStyle: -4119
Weight: 4
ThemeColor: 1
TintAndShade: 0
K>> b=get(borders,'item',5)
b =
Interface.00020854_0000_0000_C000_000000000046
K>> get(b)
Application: [1×1 Interface.000208D5_0000_0000_C000_000000000046]
Creator: 'xlCreatorCode'
Parent: [1×1 Interface.00020846_0000_0000_C000_000000000046]
Color: 0
ColorIndex: -4142
LineStyle: -4142
Weight: 2
ThemeColor: NaN
TintAndShade: NaN
K>> set(b,'LineStyle',-4119)
K>> get(b)
Application: [1×1 Interface.000208D5_0000_0000_C000_000000000046]
Creator: 'xlCreatorCode'
Parent: [1×1 Interface.00020846_0000_0000_C000_000000000046]
Color: 0
ColorIndex: -4105
LineStyle: -4119
Weight: 4
ThemeColor: 'Invoke Error, Dispatch Exception: The parameter is incorrect.←↵'
TintAndShade: 0
K>>
K>> sheetReference.Parent
ans =
Interface.000208DA_0000_0000_C000_000000000046
K>> wbk=ans;
K>> wbk.Name
ans =
'Testing.xlsx'
K>> wbk.Save
K>> wbk.Close
>> delete(excel)
>> clear('excel')
Part of extended debug session trying to figure out how to set a double line -- no success whatever; any of the values in the enumeration other than continuous (3) or none (-4142) error but if read a cell which manually set to have the desired linestyle, it returns the same value.
I've no explanation for why nor found any way in which can make the desired change programmatically.
One can't write VBA expressions that do assignments in ActiveX syntax nor are the values actually passed for the enumerated constants visible in how they're passed other than as the decimal values shown in the documentation, so if they don't work, one's pretty-much at an impasse.
That's been my frustration on almost everything I've ever tried -- it simply is not a 1:1 translation; eventually one usually can find someone on one of the Excel newsgroups or code search that has stumbled over same/similar problem and find the magic incarnation, but I've not found anything yet to get around this one.
Sorry for the rant...but was pretty-much a lost day. :(
Mario Malic
Mario Malic on 1 Jun 2021
Sadly, my hammer isn't good enough to understand these xkcd comics xD
If you look at complete object model, then yes, but we are mostly interacting with one (or few) objects so one needs to look at their documentation. Luckily their methods and properties are described meaningfully and it can be easy to narrow down the search. What would be cool is to be able to track the existing methods, properties and their values in the variable editor, like uiinspect does with the java components.
dpb
dpb on 31 May 2021
_" you can find some documentation on Excel here..."
:) Indeed.
That's the problem--there's far too much documentation; the Object Model is so complex one soon has spent the entire day trying to figure out one little piece; particularly if new to trying to use ActiveX.
And, of course, VBA syntax doesn't directly translate to ActiveX, either...
I don't disagree that it "isn't TMW's job!" but it is a bugger to do anything at all quickly unless already completely familiar with and adept in the object model.
Adam Danz
Adam Danz on 31 May 2021
Sorry, couldn't resist.... 😃
Source: xkcd.com
Mario Malic
Mario Malic on 31 May 2021
I wonder if there's a team that focuses on Excel integration.
I don't think this would ever happen, if you can interface with COM object then you can operate it with the methods that have been implemented by the program developer. It is on us to use that with whichever language we want to. I am glad that functions like writecell, readcell and others related to these exist, as I think it's hard to interface with Excel, programmatically through COM object, so thanks TMW for that.
@Robert Guldi I'll take a look at question you posted tomorrow. Meanwhile, you can find some documentation on Excel here https://docs.microsoft.com/en-us/office/vba/api/overview/excel/object-model
Robert Guldi
Robert Guldi on 31 May 2021
I'm working specifically with ActX server, and I eventually figured out everything I needed to get my program to work. While it is certianly easy to plot things in Matlab, I needed the data (which started out as a TDMS file) to be easily manipulated and viewed by people who have are very comfortable with Excel and want to be able to view and edit the charts and data with ease, much like dpb was talking about. MATLAB is very powerful and it can process the chart changes with hundreds of thousands of datapoints each much faster than Excel can, as it has to regenerate the chats any time there is a change, and it's reduce the total time to process by a factor of 10, and I think any better documentation would greatly help a very large number of people.
Adam Danz
Adam Danz on 31 May 2021
Now I want one.
dpb
dpb on 31 May 2021
"My first programming was done in the mid 90s with TI Calculators using..."
Don't get me going on geezer stories or I'll be reminiscing about Wang nixie tubes and even further back... :)
Adam Danz
Adam Danz on 31 May 2021
I wasn't aware that Excel charts can be mainpulated with Matlab or that anyone would even want to do this but I realize there are lots of different workflows outside of my own. I don't understand how it would be advantagous to use Matlab, a much more powerful tool than Excel, to create charts in Excel. The skill-set needed to do that seems greater than the skill-set needed to create a plot directly in Matlab. But you bring up a good point about programmers forced to make things work for people using Excel.
Manipulating sections of a spreadsheet or workbook is understandable and since Matlab does have functions that can read/write to specific sections of worksheet, I didn't realize there was anything more that was needed.
My first programming was done in the mid 90s with TI Calculators using a program that could upload code written in an IDE to the calculator. Then I started programming macros in Excel for years. But as soon as I learned Matlab, the rest was history concerning Excel/TI.
Matlab documentation on Python integration is growing. I wonder if there's a team that focuses on Excel integration.
dpb
dpb on 31 May 2021
Robert specifically mentioned creating and manipulating charts -- and he's right, there are no builtin facilities for handling more than reading/writing data to/from Excel.
I don't know/think that it is TMW's place to be writing MS Excel documentation translation to/from Excel, but there are a lot of people apparently trying to manipulate objects such as charts inside Excel documents from/with MATLAB.
I've just been through the process of simply trying to format an automated template created from MATLAB code and again, while it's almost trivial to build the data and formulas and write them with writecell or writetable (and, if one looks, one discovers all writecell does is call cell2table and then pass the result to writetable), but then one has to reopen the file with an Excel COM object and mung in the object model to do anything else like set number formatting.
Or, I discovered that if one needs to construct the spreadsheet piecemeal (say doing an agglomeration of data across a large collection by the unique IDs present so one gets those at one time instead of all at once) that even with writetable, the overhead of opening/closing the file is, at best, painfully slow for more than just one or two sections, or at worst, completely hangs the system.
To accomplish this goal, one has to revert to a hack of opening a COM object and writing all the data before then saving and closing the file. At least with xlswrite one has the outline of a code to do that that some others have already extended on FileExchange to do that.
Doing so reduced a process from over an hour with writetable when it did actually finally(!) run to only 7-10 seconds.
While I'd be happy if I never had seen Excel for the most part, there are millions using it and I'm stuck as a volunteer for local nonprofit with trying to make some of their manual processes built around a plethora of spreadsheets at least somewhat more productive by packaging applications to process these data for them.
Fortunately, I haven't had to deal with Excel charts (at least so far, althoug that might be on the horizon), just the data that is much simpler to pull from the dozens of workbooks, assimilate with MATLAB tables and vector operations with rowfun and friends and then put back as compared to trying to write the same functionality in VBA. But, the office folks still have to use Excel so can't just throw it away -- all a long-winded way to say I can relate to the wish and understand how it might be a need, not just a preference instead of plotting in MATLAB (and, truthfully, for some kinds of management data, the abilities packaged in Excel are light years ahead of TMW/MATLAB in functionality and appearance).
Adam Danz
Adam Danz on 31 May 2021
CAME18
CAME18 on 6 May 2021
One thing would be: defining classes in notebooks (Live Scripts in MATLAB case). That's a normal thing for years now in Python, for example.
Walter Roberson
Walter Roberson on 18 Oct 2023
You might be interested in https://www.mathworks.com/products/reference-architectures/jupyter.html which is new since you posted your wish.
cui,xingxing
cui,xingxing on 19 Feb 2021
Deep Learning toolbox:
groupedConvolution2dLayer since R2019a support, but groupedConvolution3dLayer don't support ??? (until R2020b)
update:
R2022b still can't support
Adam Danz
Adam Danz on 23 Feb 2021
@cui could you elaborate on your last comment? How did you contact MathWorks and why do you have that impression of them?
cui,xingxing
cui,xingxing on 23 Feb 2021
Mathworks-China does not actively care about my enhancement needs, but is interested in my work unit and personal contact number. I am very disappointed!
Rik
Rik on 19 Feb 2021
Maybe you could merge this answer with your previous answer with deep learning toolbox suggestions? I would also encourage you to contact support with these suggestions. It seems you have a lot of them, so they might be interested in hearing from you.
cui,xingxing
cui,xingxing on 7 Feb 2021
Deep Learning toolbox:
and so on....
The above are influential applications of deep learning in various aspects, but it is difficult to reproduce in matlab. Although Matlab2019b version supports automatic differentiation mechanism, it is still difficult to implement algorithms in matlab. The efficiency of the differentiation mechanism is not high, and many operators do not support it. I tried to implement the more famous yolov3/v4 algorithm with the latest MATLAB2020a version, but it is still not satisfactory
In summary, my personal suggestions are like my personal answer above, and I hope that future versions can improve a lot!
以上都为深度学习在各个方面有影响力的应用,但是在matlab中复现困难,虽然Matlab2019b版本支持自动微分机制,但仍然不易在matlab实现算法,微分机制效率不高,很多operators也不支持。。。
总之,我的个人建议就像上面的个人回答建议一样,我希望将来的版本可以有所改善!
cui,xingxing
cui,xingxing on 24 Sep 2021
I have been following the latest development progress of "deeplearning toolbox", and although there are many new features listed, most of them are superficial improvements with very limited substantive support for the "operator", which is still very inadequate for experienced and in-depth researchers.
I hope that mathworks will seriously develop basic modules for the toolbox, instead of small features that are not very important to attract beginners.
我一直在关注“deeplearning toolbox”的最新开发进展,虽然有很多新的功能项被列出来,但这些大部分都是表面上改进,实质上的支持operator非常有限,对于有经验的深入研究者来说还显现的非常不足。
cui,xingxing
cui,xingxing on 7 Feb 2021
MATLAB
I very much hope that the official version will strengthen the readstruct function in the future! Lack of complete uniformity to support more format requirements.
cui,xingxing
cui,xingxing on 7 Feb 2021
Deep Learning toolbox:
How to visualize the changes in dlarray/weight distribution with histograms in deep learning?
Histogram displays how the trend of tensor (weight, bias, gradient, etc.) changes during the training process in the form of histogram. Developers can adjust the model structures accurately by having an in-depth understanding of the effect of each layer.
cui,xingxing
cui,xingxing on 5 Jan 2023
it's lucky to hear that recently matlab version support deepnetwork visualize weight distribution. here is one example link
cui,xingxing
cui,xingxing on 9 Feb 2021
@Adam Danz Thank you for your suggestions, I look forward to the official future version will be greatly improved!
Adam Danz
Adam Danz on 9 Feb 2021
The first plot is similar to Matlab's waterfall plotting function.
The GIF is too quick for me to make any sense out of it.
Perhaps you could directly suggest these ideas using Contact Us - MATLAB & Simulink
Bruno Luong
Bruno Luong on 9 Feb 2021
This thread is not an official enhancement request.
To me it's simply a place where people come to emplty the bag of complains.
dpb
dpb on 9 Feb 2021
TMW will not comment in open forum on pending development or toolbox direction; you can be confident they have seen and read the above, but you cannot interpret no response as no interest.
If you wanted more direct input, submit items as enhancement requests, but again, TMW simply does not share its plans in open forums.
cui,xingxing
cui,xingxing on 9 Feb 2021
Related issues:
It seems that Mathworks is not interested in many of the improvement questions (above and below) raised by me, and I regret that there is still no answer!