Discover MakerZone

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

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
some suggestions on Matlab Editor

Subject: some suggestions on Matlab Editor

From: Wiggin

Date: 16 Sep, 2010 14:32:19

Message: 1 of 22

I don't know if anybody have proposed something like this, but I think the Matlab Editor is still not perfect. In my opinion, it is not as convenient as MS Visual studio with Visual Assist X. For example,
1. VS can cut/copy a whole line with ctrl+X/C on the line, but in Matlab, you must first select the whole line then cut/copy.
2. It is strange that Matlab Editor support ctrl+Delete to delete a word, but don't support ctrl+Backspace.
3. In Matlab Editor there is variable/function suggestion, but it only suggests variables in the Workspace. I think it's better to suggest all the variables appeared in the codes above, as VAX does in VS. Plus, the function suggestion is rather slow.
4. Lately VAX released a new feature, which is when you put your cursor on a symbol(variable/function), the same symbol all over the file will be highlighted. It is especially useful when you want to check out where you have used this symbol.

some other stuff:
5. Why doesn't Matlab language support '++' and '+='? These operators will save much typing.
6. Can I export every setting of Matlab, so I can import it on another computer?
7. I find that when I copy a figure, there will always be a border around it. Can I remove it from the figure?

Hope for your comments!

Subject: some suggestions on Matlab Editor

From: Walter Roberson

Date: 16 Sep, 2010 16:26:37

Message: 2 of 22

On 16/09/10 9:32 AM, Wiggin wrote:

> 5. Why doesn't Matlab language support '++' and '+='? These operators
> will save much typing.

Matlab does not have any assignment *expressions* -- no way to do
assignments in-line as part of a more complicated expression. The one
exception to that is the use of assignin('caller') and assignin('base').
If you use evalin('caller') and assignin('caller') in function calls in
the same expression, Matlab does not define the result, but the result
would have to become defined if ++ or += and the other inline
assignments became defined.

Subject: some suggestions on Matlab Editor

From: Sean

Date: 16 Sep, 2010 16:40:23

Message: 3 of 22

"Wiggin " <xjed05@gmail.com> wrote in message <i6t9pj$m6$1@fred.mathworks.com>...
> I don't know if anybody have proposed something like this, but I think the Matlab Editor is still not perfect. In my opinion, it is not as convenient as MS Visual studio with Visual Assist X. For example,
> 1. VS can cut/copy a whole line with ctrl+X/C on the line, but in Matlab, you must first select the whole line then cut/copy.
> 2. It is strange that Matlab Editor support ctrl+Delete to delete a word, but don't support ctrl+Backspace.
> 3. In Matlab Editor there is variable/function suggestion, but it only suggests variables in the Workspace. I think it's better to suggest all the variables appeared in the codes above, as VAX does in VS. Plus, the function suggestion is rather slow.
> 4. Lately VAX released a new feature, which is when you put your cursor on a symbol(variable/function), the same symbol all over the file will be highlighted. It is especially useful when you want to check out where you have used this symbol.
>
> some other stuff:
> 5. Why doesn't Matlab language support '++' and '+='? These operators will save much typing.
> 6. Can I export every setting of Matlab, so I can import it on another computer?
> 7. I find that when I copy a figure, there will always be a border around it. Can I remove it from the figure?
>
> Hope for your comments!

I wish the 'home', 'end' buttons from a Windows-like keyboard worked in the editor on a Macintosh. There may be some way to adjust this but I haven't been able to figure it out.

Subject: some suggestions on Matlab Editor

From: Steven_Lord

Date: 16 Sep, 2010 17:18:14

Message: 4 of 22



"Wiggin " <xjed05@gmail.com> wrote in message
news:i6t9pj$m6$1@fred.mathworks.com...
> I don't know if anybody have proposed something like this, but I think the
> Matlab Editor is still not perfect. In my opinion, it is not as convenient
> as MS Visual studio with Visual Assist X. For example,
> 1. VS can cut/copy a whole line with ctrl+X/C on the line, but in Matlab,
> you must first select the whole line then cut/copy.
> 2. It is strange that Matlab Editor support ctrl+Delete to delete a word,
> but don't support ctrl+Backspace.
> 3. In Matlab Editor there is variable/function suggestion, but it only
> suggests variables in the Workspace. I think it's better to suggest all
> the variables appeared in the codes above, as VAX does in VS. Plus, the
> function suggestion is rather slow.
> 4. Lately VAX released a new feature, which is when you put your cursor on
> a symbol(variable/function), the same symbol all over the file will be
> highlighted. It is especially useful when you want to check out where you
> have used this symbol.
>
> some other stuff:
> 5. Why doesn't Matlab language support '++' and '+='? These operators will
> save much typing.
> 6. Can I export every setting of Matlab, so I can import it on another
> computer?
> 7. I find that when I copy a figure, there will always be a border around
> it. Can I remove it from the figure?
>
> Hope for your comments!

In general, you should send these comments to Technical Support so that they
can be captured in the enhancement database. For some of your specific
comments:

4) See the Release Notes for release R2010b:

http://www.mathworks.com/help/techdoc/rn/bskaaam-1.html#bskaaan-23

5) This has been discussed on this newsgroup frequently. When working with
scalars, the behavior of ++ and += are fairly easy to define. When working
with non-scalars, things are a bit tricker. What do you think the values of
a, b, and c should be after this block of code is executed?

a = 0;
a([1 1])++

b = 1;
b([1 1]) += b([1 1])

c = [1 2];
c([1 2]) += c([2 1])

Should a be 1, 2, or something else? Should b be 2, 3, 4, or something
else? Is c equal to [3 3], [3 5], or something else?

7) That depends ... how are you copying the figure? Are you copying just
the _axes_ or the _figure_ as a whole?

--
Steve Lord
slord@mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Subject: some suggestions on Matlab Editor

From: Yair Altman

Date: 16 Sep, 2010 20:10:22

Message: 5 of 22

> 1. VS can cut/copy a whole line with ctrl+X/C on the line, but in Matlab, you must first select the whole line then cut/copy.
> 2. It is strange that Matlab Editor support ctrl+Delete to delete a word, but don't support ctrl+Backspace.

Try using the EditorMacro utility on the File Exchange: http://www.mathworks.com/matlabcentral/fileexchange/24615

> 4. Lately VAX released a new feature, which is when you put your cursor on a symbol(variable/function), the same symbol all over the file will be highlighted. It is especially useful when you want to check out where you have used this symbol.

Available in R2010b

> 6. Can I export every setting of Matlab, so I can import it on another computer?

Yes - simply copy your preferences folder (type prefdir at the Matlab Prompt to know where it is).

> 7. I find that when I copy a figure, there will always be a border around it. Can I remove it from the figure?

Try using box('off')

Yair Altman
http://UndocumentedMatlab.com

Subject: some suggestions on Matlab Editor

From: Walter Roberson

Date: 16 Sep, 2010 21:44:07

Message: 6 of 22

On 10-09-16 03:10 PM, Yair Altman wrote:

>> 6. Can I export every setting of Matlab, so I can import it on another
>> computer?
>
> Yes - simply copy your preferences folder (type prefdir at the Matlab
> Prompt to know where it is).

I wonder if that works between versions including going to older versions? And
I wonder if it works between different platforms ?

Subject: some suggestions on Matlab Editor

From: Yair Altman

Date: 17 Sep, 2010 09:06:06

Message: 7 of 22

Walter Roberson <roberson@hushmail.com> wrote in message <i6u379$4g7$2@canopus.cc.umanitoba.ca>...
> On 10-09-16 03:10 PM, Yair Altman wrote:
>
> >> 6. Can I export every setting of Matlab, so I can import it on another
> >> computer?
> >
> > Yes - simply copy your preferences folder (type prefdir at the Matlab
> > Prompt to know where it is).
>
> I wonder if that works between versions including going to older versions? And
> I wonder if it works between different platforms ?

In my experience it does in most cases. Matlab mostly adds new config items and files in new releases, but generally does not change existing configs. This is done in order to facilitate upgrading to a new release, but it also helps in downgrades. Extra configs are simply ignored (I use this fact as an important basis for my CPRINTF utility on the File Exchange). You will probably only get into trouble if you use widely-different releses, e.g. from R2010b to 6.0. But if you're doing this you'd probably expect trouble in any case since none of your apps will probably work as expected.

Regarding different platforms - if you look at the config items you'll see that almost all of them are generic and not platform-dependent.

Yair Altman
http://UndocumentedMatlab.com

Subject: some suggestions on Matlab Editor

From: Wiggin

Date: 17 Sep, 2010 11:10:06

Message: 8 of 22

Thanks a lot! Your answer is helpful on question 4 and 6. But for 2, I tried your function and used
EditorMacro('Ctrl Back_space', 'remove-word-previous', 'run')
but ctrl+backspace still doesn't work.

"Yair Altman" <altmanyDEL@gmailDEL.comDEL> wrote in message <i6ttje$gj8$1@fred.mathworks.com>...
> > 1. VS can cut/copy a whole line with ctrl+X/C on the line, but in Matlab, you must first select the whole line then cut/copy.
> > 2. It is strange that Matlab Editor support ctrl+Delete to delete a word, but don't support ctrl+Backspace.
>
> Try using the EditorMacro utility on the File Exchange: http://www.mathworks.com/matlabcentral/fileexchange/24615
>
> > 4. Lately VAX released a new feature, which is when you put your cursor on a symbol(variable/function), the same symbol all over the file will be highlighted. It is especially useful when you want to check out where you have used this symbol.
>
> Available in R2010b
>
> > 6. Can I export every setting of Matlab, so I can import it on another computer?
>
> Yes - simply copy your preferences folder (type prefdir at the Matlab Prompt to know where it is).
>
> > 7. I find that when I copy a figure, there will always be a border around it. Can I remove it from the figure?
>
> Try using box('off')
>
> Yair Altman
> http://UndocumentedMatlab.com

Subject: some suggestions on Matlab Editor

From: Yair Altman

Date: 17 Sep, 2010 11:40:23

Message: 9 of 22

"Wiggin " <xjed09@gmail.com> wrote in message
> Thanks a lot! Your answer is helpful on question 4 and 6. But for 2, I tried your function and used
> EditorMacro('Ctrl Back_space', 'remove-word-previous', 'run')
> but ctrl+backspace still doesn't work.
>
> > > 1. VS can cut/copy a whole line with ctrl+X/C on the line, but in Matlab, you must first select the whole line then cut/copy.
> > > 2. It is strange that Matlab Editor support ctrl+Delete to delete a word, but don't support ctrl+Backspace.
> >
> > Try using the EditorMacro utility on the File Exchange: http://www.mathworks.com/matlabcentral/fileexchange/24615


This is because there is no 'remove-word-previous' action in the Matlab editor. You can use a combination of the 'caret-previous-word' and 'remove-word-next' actions.

In the Command Window, there is such an action but it is called 'delete-previous-word'.

While you're at it, selection of the entire line is done using the 'select-line' action in both editor & CW. There is also a 'kill-line' action, in both editor & CW.

You can run the following to get the list of all available key-bindings and actions:
[bindings, actions]= EditorMacro


Yair Altman
http://UndocumentedMatlab.com

Subject: some suggestions on Matlab Editor

From: ImageAnalyst

Date: 17 Sep, 2010 12:12:51

Message: 10 of 22

On Sep 16, 10:32 am, "Wiggin " <xje...@gmail.com> wrote:
> I don't know if anybody have proposed something like this, but I think the Matlab Editor is still not perfect. In my opinion, it is not as convenient as MS Visual studio with Visual Assist X. For example,
> 1. VS can cut/copy a whole line with ctrl+X/C on the line, but in Matlab, you must first select the whole line then cut/copy.
-------------------------------------------
#1 would be SO nice. I had a programmers editor back in the early
90's called Brief (by a company called Underware) and it had that
feature. You could just hit the + on the numeric keypad to copy into
the clipboard and the - key to cut into the clipboard. If you had
nothing highlighted, it would take the whole line that your cursor was
on, otherwise it would take just what you highlighted. It was very
convenient. Then to paste you would simply hit the insert key on the
middle keypad. These one keystroke solutions were so convenient that
many other editors that came along afterward (Codewright, slickedit,
etc.) offered the Brief keymap as an option. I always hated the
standard two-step/two-finger method (first highlight entire line, then
control-c) of the standard "CUA" of Windows - it's very non-programmer
friendly, but sadly many editor adopt it and don't offer alternate
keymaps.

Subject: some suggestions on Matlab Editor

From: Christina Roberts

Date: 23 Sep, 2010 20:45:23

Message: 11 of 22

1. Request: VS can cut/copy a whole line with ctrl+X/C on the line, but in Matlab, you must first select the whole line then cut/copy.

You can use kill line (Ctrl+K in Emacs set, can be defined in Windows or Mac set using Keyboard Shortcut preferences) to delete from the cursor to the end of line.

2. Request: It is strange that Matlab Editor support ctrl+Delete to delete a word, but don't support ctrl+Backspace.

This was added to the Editor in R2010b.

3. Request: In Matlab Editor there is variable/function suggestion, but it only suggests variables in the Workspace. I think it's better to suggest all the variables appeared in the codes above, as VAX does in VS.

Local string tab completion was added to the Editor in R2010a.

4. Request: Lately VAX released a new feature, which is when you put your cursor on a symbol(variable/function), the same symbol all over the file will be highlighted.

Variable/function highlighting within a file was added in R2010b.


-Christina Roberts
The MathWorks, Inc.

Subject: some suggestions on Matlab Editor

From: JussiJ

Date: 22 Oct, 2010 06:30:59

Message: 12 of 22

On Sep 17, 11:12 pm, ImageAnalyst <imageanal...@mailinator.com> wrote:

> #1 would be SO nice. I had a programmers editor back in the early
> 90's called Brief
> .....
> I always hated the standard two-step/two-finger method (first highlight
> entire line, then control-c) of the standard "CUA" of Windows - it's
> very non-programmer friendly, but sadly many editor adopt it and don't
> offer alternate keymaps.

Zeus is a Windows based editor with a fully configurable keyboard
and in fact one of the available keyboard mappings is the Brief
mapping:

    http://www.zeusedit.com

In fact Zeus also has a BriefEx keyboard mapping that is a
combination
of the Brief keyboard mapping and the Windows CUA keyboard shortcuts
offering the best of both worlds ;)

Jussi Jumppanen
Author: Zeus for Windows IDE

Subject: some suggestions on Matlab Editor

From: Bruno Luong

Date: 22 Oct, 2010 07:06:03

Message: 13 of 22

"Steven_Lord" <slord@mathworks.com> wrote in message <i6tjgm$jbc$1@fred.mathworks.com>...

>
> 5) This has been discussed on this newsgroup frequently. When working with
> scalars, the behavior of ++ and += are fairly easy to define. When working
> with non-scalars, things are a bit tricker. What do you think the values of
> a, b, and c should be after this block of code is executed?
>
> a = 0;
> a([1 1])++
>
> b = 1;
> b([1 1]) += b([1 1])
>
> c = [1 2];
> c([1 2]) += c([2 1])
>
> Should a be 1, 2, or something else? Should b be 2, 3, 4, or something
> else? Is c equal to [3 3], [3 5], or something else?

Logically, it would behave respectively exactly like
a([1 1]) = a([1 1])+1
b([1 1]) = b([1 1])+ b([1 1])
c([1 2]) = c([1 2]) + c([2 1])

TMW can stick with the interpretation they have imposed. The += and ++ operators must be parsed and converted to old-style syntax and nothing more.

Another enhancement they should consider is cascade indexing. There is no technical or logical reason why such thing could not be implemented.

Bruno

Subject: some suggestions on Matlab Editor

From: James Tursa

Date: 22 Oct, 2010 07:20:05

Message: 14 of 22

"Steven_Lord" <slord@mathworks.com> wrote in message <i6tjgm$jbc$1@fred.mathworks.com>...
>
> 5) This has been discussed on this newsgroup frequently. When working with
> scalars, the behavior of ++ and += are fairly easy to define. When working
> with non-scalars, things are a bit tricker. What do you think the values of
> a, b, and c should be after this block of code is executed?
>
> a = 0;
> a([1 1])++
>
> b = 1;
> b([1 1]) += b([1 1])
>
> c = [1 2];
> c([1 2]) += c([2 1])
>
> Should a be 1, 2, or something else? Should b be 2, 3, 4, or something
> else? Is c equal to [3 3], [3 5], or something else?

I am not advocating that MATLAB adopt the ++ etc operators, but it seems to me that a simple ground rule that these expressions are undefined and may throw an error could be adopted. The same situation applies to C. e.g., what is the result of the following?

a = 1;
b = (a++) + 2*(a++);

Which a++ got executed first? The result for b depends on the answer to this question, but the programmer has no control over this. Since the compiler is free to choose, the result for b is not defined and thus constructs like this must be avoided.

A similar situation could be adopted for MATLAB. Whether this would be a *smart* thing for MATLAB to do is another matter, since that would open the door to run-time errors that could be very hard to track down unless MATLAB also put in place argument checking (e.g. throw a run-time error in the a(x)++ case if x contains any duplicate entries, etc.).

James Tursa

Subject: some suggestions on Matlab Editor

From: Bruno Luong

Date: 22 Oct, 2010 08:22:04

Message: 15 of 22

"James Tursa" <aclassyguy_with_a_k_not_a_c@hotmail.com> wrote in message <i9rdv5$bt$1@fred.mathworks.com>...

>
> Which a++ got executed first?

I think the discussion is always turned around: "what is the logical design choice we should adopt?". TMW just stick with a choice they select (such as expression is evaluated from left to right). An existing of design choice is not the reason why it's not possible to design, as long as the language is well defined and there is no contradiction with itself.

I don't care for ++ and += either, this seems to bother mostly C-people, but they just need to adapt to Matlab vectorized-philosophy rather than programming with increment counter and inplace increment as theu do in C.

But IMO cascade indexing is something that can enhance greatly Matlab language.

Bruno

Subject: some suggestions on Matlab Editor

From: tristram.scott@ntlworld.com (Tristram Scott)

Date: 22 Oct, 2010 10:12:06

Message: 16 of 22

Bruno Luong <b.luong@fogale.findmycountry> wrote:
[snip]

> But IMO cascade indexing is something that can enhance greatly Matlab
> language.
>

Can you explain what you mean by cascade indexing, or point me to a
reference somewhere? It is not a term I am familar with.

Perhaps, in theme, you should point me to a reference to a reference ...


--
Dr Tristram J. Scott
Energy Consultant

Subject: some suggestions on Matlab Editor

From: Bruno Luong

Date: 22 Oct, 2010 11:16:04

Message: 17 of 22

"Bruno Luong" <b.luong@fogale.findmycountry> wrote in message <i9rhjc$mkd$1@fred.mathworks.com>...
> "James Tursa" <aclassyguy_with_a_k_not_a_c@hotmail.com> wrote in message <i9rdv5$bt$1@fred.mathworks.com>...
>
> >
> > Which a++ got executed first?
>
> I think the discussion is always turned around: "what is the logical design choice we should adopt?". TMW just stick with a choice they select (such as expression is evaluated from left to right). An existing of design choice is not the reason why it's not possible to design, as long as the language is well defined and there is no contradiction with itself.
>
> I don't care for ++ and += either, this seems to bother mostly C-people, but they just need to adapt to Matlab vectorized-philosophy rather than programming with increment counter and inplace increment as theu do in C.
>
> But IMO cascade indexing is something that can enhance greatly Matlab language.

Like this:

A = rand(5,5);
m3 = mean(A,1)(3);

Bruno

Subject: some suggestions on Matlab Editor

From: James Tursa

Date: 22 Oct, 2010 14:07:02

Message: 18 of 22

"Bruno Luong" <b.luong@fogale.findmycountry> wrote in message <i9rhjc$mkd$1@fred.mathworks.com>...
>
> I don't care for ++ and += either, this seems to bother mostly C-people, but they just need to adapt to Matlab vectorized-philosophy rather than programming with increment counter and inplace increment as theu do in C.

Well, I didn't mean to imply that I didn't *like* the ++, +=, etc operators. In fact I do and I use they quite a bit in my C programming. But it has never bothered me that they are not a part of MATLAB.

James Tursa

Subject: some suggestions on Matlab Editor

From: tristram.scott@ntlworld.com (Tristram Scott)

Date: 23 Oct, 2010 11:36:38

Message: 19 of 22

Bruno Luong <b.luong@fogale.findmycountry> wrote:
> "Bruno Luong" <b.luong@fogale.findmycountry> wrote in message <i9rhjc$mkd$1@fred.mathworks.com>...
>> But IMO cascade indexing is something that can enhance greatly Matlab
> language.
>
> Like this:
>
> A = rand(5,5);
> m3 = mean(A,1)(3);
>
> Bruno

Would you expect that to be equivalent to the following?

A = rand(5,5);
m = mean(A,1);
m3 = m(3);


--
Dr Tristram J. Scott
Energy Consultant

Subject: some suggestions on Matlab Editor

From: Bruno Luong

Date: 23 Oct, 2010 11:54:04

Message: 20 of 22

tristram.scott@ntlworld.com (Tristram Scott) wrote in message
> >
> > Like this:
> >
> > A = rand(5,5);
> > m3 = mean(A,1)(3);
> >
> > Bruno
>
> Would you expect that to be equivalent to the following?
>
> A = rand(5,5);
> m = mean(A,1);
> m3 = m(3);
>

Yes. The exact equivalent would have one additional command:

clear m;

The code is suddenly more compact and clearer.

Bruno

Subject: some suggestions on Matlab Editor

From: james bejon

Date: 23 Oct, 2010 17:07:05

Message: 21 of 22

I'm surprised cascading indexing isn't possible in Matlab, since Octave seems to handle it fine.

Subject: some suggestions on Matlab Editor

From: Wiggin

Date: 26 Oct, 2010 10:55:07

Message: 22 of 22

"Bruno Luong" <b.luong@fogale.findmycountry> wrote in message <i9rhjc$mkd$1@fred.mathworks.com>...
> "James Tursa" <aclassyguy_with_a_k_not_a_c@hotmail.com> wrote in message <i9rdv5$bt$1@fred.mathworks.com>...
>
> >
> > Which a++ got executed first?
>
> I think the discussion is always turned around: "what is the logical design choice we should adopt?". TMW just stick with a choice they select (such as expression is evaluated from left to right). An existing of design choice is not the reason why it's not possible to design, as long as the language is well defined and there is no contradiction with itself.
>
> I don't care for ++ and += either, this seems to bother mostly C-people, but they just need to adapt to Matlab vectorized-philosophy rather than programming with increment counter and inplace increment as theu do in C.
>
> But IMO cascade indexing is something that can enhance greatly Matlab language.
>
> Bruno

I am always searching for shorter expressions, so when I write an expression like this:
imageA(imageA > coefA & imageA < coefB) = imageA(imageA > coefA & imageA < coefB)+coefA
It reminds me of something like ++ and += . It will be clearer to read, too.
Of course, it's not a very crucial problem.
By the way, I agree with your opinion on "cascade indexing".

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us