Search Comments and Ratings

go

Comments and Ratings

   
Date File Comment by Comment Rating
17 Nov 2009 cprintf - display formatted colored text in the Command Window Displays sprintf-formatted strings in the Command Window using the specified color/underline style Author: Yair Altman bocovp

08 Nov 2009 PlotData - display plot raw-data in data-tables Displays raw data of figure plots in separate spreadsheet tables Author: Yair Altman Shimoni, Raz

06 Nov 2009 FindJObj - find java handles of Matlab graphic objects Find java objects contained within a specified java container or Matlab GUI handle Author: Yair Altman James

thx

03 Nov 2009 SoundVolume - set or get the system speaker sound volume SoundVolume sets or gets the computer system's speaker sound volume, using Java Author: Yair Altman Nguyen, D

I used this to integrate it with a GUI slider to control the system volume. Worked great! Had to slightly modify te code..
ctrls(ctrlIdx).getType to ctrls(ctrlIdx).getType.toString..with Yair Altman's help to get it to work on my system. Windows XP with MATLAB 7.0.4.365(R14) SP2, but otherwise works fine!

03 Nov 2009 cprintf - display formatted colored text in the Command Window Displays sprintf-formatted strings in the Command Window using the specified color/underline style Author: Yair Altman Millo, A

11 Oct 2009 ScrollPlot - scrollable X/Y axes ScrollPlot adds a scroll sub-window to any supplied plot handles. Author: Yair Altman zao, leo

Hello!
Thanks a lot for this really nice and useful function!
I tried it with a time series and unfortunately the axes of the scrollplot part don't seem to "react" to the function "datetick". (It labels the tick lines of an axis using dates, replacing the default numeric labels)
I am a beginner with matlab and if someone know how to deal using dates with the function scrollplot, I would be very grateful!
Thanks a lot!
Leo

11 Oct 2009 ScrollPlot - scrollable X/Y axes ScrollPlot adds a scroll sub-window to any supplied plot handles. Author: Yair Altman zao, leo

08 Oct 2009 statusbar set/get status bar(s) for GUI figures & Matlab desktop Author: Yair Altman Queffurust, Aurelien

Tested in R2009b, it works perfectly, the function is really well documented . I used all the customization (toollip, background ...)
It is very good to have a waitbar "docked". Thanks !

06 Oct 2009 EditorMacro - assign a macro to a keyboard key-stroke in the Matlab Editor and Command Window EditorMacro assigns a macro or action to requested key-binding in the Matlab Editor & Command Window Author: Yair Altman Pudeyev, Andrey

Great work, just the very thing I missed in a matlab interface - a customizable macro.

Summarizing the examples of posted here, i propose the following solution for exception management:
-----------
function trycatch(hDocument,eventData)
% Get Selected text in current editor
selectedText = char(hDocument.getSelectedText);

modifiedText = ['try' char(13) selectedText char(13) 'catch' char(13) 'keyboard' char(13) 'end'];

% Update selection in current editor
hDocument.replaceSelection(modifiedText);
--------------

This will allow quickly put the selected text block inside try-catch construction

06 Oct 2009 EditorMacro - assign a macro to a keyboard key-stroke in the Matlab Editor and Command Window EditorMacro assigns a macro or action to requested key-binding in the Matlab Editor & Command Window Author: Yair Altman Pudeyev, Andrey

30 Sep 2009 Java-based data table Spreadsheet display/editing/sorting of data with multiple features Author: Yair Altman Hans

Hello Yair, hello Jeffrey,

I still appreciate the createTable() function, but honestly it took me some time to make it work with the new uitable() call using the r2009a release. My problem was NOT inserting 'vo' to modify the line ..
   mtable = uitable(hFig, ..
to this ..
   mtable = uitable('v0',hFig, ..
but my figure just did not have any jtable.

This got immediately solved when I set the visibility of the figure to 'on' before using the createTable() call. It seems like some parent/child objects needed by createTable() cannot be found when the figure is invisible. I never had this problem with the old r2007a release.

Anyway, it now works for me (hopefully for others to) and the modifications to Yair's createTable.m-code were less than tiny.

Thanks again Yair for your work.

29 Sep 2009 FindJObj - find java handles of Matlab graphic objects Find java objects contained within a specified java container or Matlab GUI handle Author: Yair Altman Woodford, Oliver

Great function. The interactive display is a brilliant feature.

29 Sep 2009 cprintf - display formatted colored text in the Command Window Displays sprintf-formatted strings in the Command Window using the specified color/underline style Author: Yair Altman Frank, Florian

This is a great little tool! Thank You!

23 Sep 2009 Convert a vector/array/matrix of values into a comma-separated string Converts input of unknown size/type into compact single-line string suitable for log files & uitable Author: Yair Altman Hunter, Courtney

I am having REAL trouble because Matlab doesn't recognize the 'vec2str' character. I am trying to create a function that takes a vector of length N^2 and convert it to a corresponding NxN matrix. I will later input the size of N, but for now I need to convert a vector of size N to a matrix of size NxN. Please help!

17 Sep 2009 ScrollPlot - scrollable X/Y axes ScrollPlot adds a scroll sub-window to any supplied plot handles. Author: Yair Altman shalom, almog

Forgot the rating ...

11 Sep 2009 ScrollPlot - scrollable X/Y axes ScrollPlot adds a scroll sub-window to any supplied plot handles. Author: Yair Altman Altman, Yair

Almog - The warnings can be eliminated by typing:

warning off MATLAB:HandleGraphics:ObsoletedProperty:JavaFrame

I'll add it to a new version when I get to it, but in the meantime you can simply add this to your startup.m file or your Matlab Command Window. It has no negative effect.

אשמח אם תוכל להקדיש רגע להזין רייטינג :-)

09 Sep 2009 ScrollPlot - scrollable X/Y axes ScrollPlot adds a scroll sub-window to any supplied plot handles. Author: Yair Altman shalom, almog

Nice.
One comment:
When I try it, MATLAB prouce the following warning:

Warning: figure JavaFrame property will be obsoleted in a future release. For more information see
the JavaFrame resource on the MathWorks Web site.

(with a link to http://www.mathworks.com/support/contact_us/dev/javaframe.html )

28 Aug 2009 ScrollPlot - scrollable X/Y axes ScrollPlot adds a scroll sub-window to any supplied plot handles. Author: Yair Altman Tim

A version that would link scrolling across subplots would be very cool.

26 Aug 2009 EditorMacro - assign a macro to a keyboard key-stroke in the Matlab Editor and Command Window EditorMacro assigns a macro or action to requested key-binding in the Matlab Editor & Command Window Author: Yair Altman Altman, Yair

For those interested, a set of EditorMacro macro functions has been submitted by Perttu Ranta-aho. The submission is called "TextTools" and can be found here: http://www.mathworks.com/matlabcentral/fileexchange/25122

24 Aug 2009 enable/disable figure enable/disable an entire figure window Author: Yair Altman Cem

Yair,
     Thank you. It worked like a charm.

22 Aug 2009 EditorMacro - assign a macro to a keyboard key-stroke in the Matlab Editor and Command Window EditorMacro assigns a macro or action to requested key-binding in the Matlab Editor & Command Window Author: Yair Altman Ozgur, Ustun

EditorMacro('Alt-x', 'try\n % Main code here\ncatch\n % Exception handling here\nend');

does not work in OS X with Matlab R2008b.

EditorMacro('Meta x', 'try\n % Main code here\ncatch\n % Exception handling here\nend');

works however.

20 Aug 2009 Java-based data table Spreadsheet display/editing/sorting of data with multiple features Author: Yair Altman Jeffrey

Hey Yair,

Can you update this for the new uitable?

Thanks!

11 Aug 2009 FindJObj - find java handles of Matlab graphic objects Find java objects contained within a specified java container or Matlab GUI handle Author: Yair Altman Patrick

I made a slider using GUIDE; its handle is hSlider.
I called jSlider = findjobj(hSlider);
I tried this with MATLAB 2007b, this worked very well, thank you.

Then I tried this with MATLAB 2009a, findjobj returned empty!
Actually, calling findjobj with any arguments all returned empty.

What did I do wrong?

07 Aug 2009 FindJObj - find java handles of Matlab graphic objects Find java objects contained within a specified java container or Matlab GUI handle Author: Yair Altman Hasnan, Saidul

Why do I get this error whenever i tried findjobj;

??? findjobj: Undefined function or variable "jcb".

I have the latest version of findjobj file.

02 Aug 2009 FindJObj - find java handles of Matlab graphic objects Find java objects contained within a specified java container or Matlab GUI handle Author: Yair Altman Boris

24 Jul 2009 statusbar set/get status bar(s) for GUI figures & Matlab desktop Author: Yair Altman Altman, Yair

JavaFrame has no alternative. If and when it is discontinued in some future version we shall try to look for alternatives. Until then simply ignore this error by typing:

warning off MATLAB:HandleGraphics:ObsoletedProperty:JavaFrame

Note that even if some future version discontinues JavaFrame, it will still continue to work properly on all prior Matlab versions (including your current version).

If you find JavaFrame to be useful for your needs, please consider letting MathWorks know about this in the webpage they dedicated for just this purpose:

http://www.mathworks.com/support/contact_us/dev/javaframe.html

24 Jul 2009 statusbar set/get status bar(s) for GUI figures & Matlab desktop Author: Yair Altman Gianoli, Stefano

Very nice implementation. Though I receive this warning message.:

Warning: figure JavaFrame property will be obsoleted in a future release. For more information see the JavaFrame
resource on the MathWorks Web site.
> In statusbar>setFigureStatus at 202
  In statusbar at 148

I am using MATLAB Version 7.6.0.324 (R2008a)

Is there an alternative to JavaFrame function that will be supported in future releases?

23 Jul 2009 OfficeDoc - read/write/format MS Office docs (XLS/DOC/PPT) Read/write/append/format/display data, images & screenshots in MS Office documents (XLS/DOC/PPT) Author: Yair Altman T, Anthony

21 Jul 2009 FindJObj - find java handles of Matlab graphic objects Find java objects contained within a specified java container or Matlab GUI handle Author: Yair Altman Hopkins, Jesse

I've actually solved my problem. After reading this page: http://undocumentedmatlab.com/blog/uicontrol-callbacks/,
I tried changing the way I set the callbacks. Before, I set the callbacks directly on the java-object. However, when I used the handle() function and then set the callbacks the problem disappears.

In summary:
before:
set(myJavaObject,'MouseReleasedCallback',@callbackfcn);

now:
myHandle = handle(myJavaObject,'CallbackProperties');
set(myHandle,'MouseReleasedCallback,@callbackfcn)

21 Jul 2009 FindJObj - find java handles of Matlab graphic objects Find java objects contained within a specified java container or Matlab GUI handle Author: Yair Altman Hopkins, Jesse

I've been using this file for about a year now (great work Yair!), and a very weird issue has crept up now that I've upgraded from R2007b to R2008b.

What happens to me is that I have a few custom java-objects instantiated (they are a modified version of the java-swing table), with userdata and function callbacks associated with them via calls like: set(myTableObj,'MouseReleasedCallback',@callbackfcn);
set(myTableObj,'userdata',data);

After findjobj returns, all of the userdata and callbacks have been cleared out. I've stepped through findjobj line by line, and cannot find a culprit. In fact, when I get to the "return" line on 279, the userdata and function callbacks are still properly associated with the java-objects. However, once findjobj returns, all userdata and function callbacks of my java-objects are cleared to an empty matrix.

Any thoughts on this?

20 Jul 2009 EditorMacro - assign a macro to a keyboard key-stroke in the Matlab Editor and Command Window EditorMacro assigns a macro or action to requested key-binding in the Matlab Editor & Command Window Author: Yair Altman Julien

Excellent work indeed, thank you very much for sharing this very useful and powerful function.
For users which would be interested in modifying selected text and not inserting new text at caret position, you can use the jEditorPane methods "getSelectedText" and "replaceSelection".
For example, if you want to transform selected text in current editor to upper case characters, you can do as follow :
---------------------------------------------------------------------------
function Upper_Macro(hDocument,eventData)
% Get Selected text in current editor
selectedText = char(hDocument.getSelectedText);
if isempty(selectedText)
    return;
end
% Modify selected text to upper case character
modifiedText = upper(selectedText);
% Update selection in current editor
hDocument.replaceSelection(modifiedText);
---------------------------------------------------------------------------
And simply run in the command window :
>>macros = EditorMacro('ctrl-u',@Upper_Macro,'run');
---------------------------------------------------------------------------
Thank you again Yair !

05 Jul 2009 FindJObj - find java handles of Matlab graphic objects Find java objects contained within a specified java container or Matlab GUI handle Author: Yair Altman Altman, Yair

@Leonardo - FindJObj does not enable modifying the displayed object hierarchy - perhaps I will add this feature in a future version. You need to update the hierarchy outside FindJObj and then click on the <Refresh Tree> button.

04 Jul 2009 EditorMacro - assign a macro to a keyboard key-stroke in the Matlab Editor and Command Window EditorMacro assigns a macro or action to requested key-binding in the Matlab Editor & Command Window Author: Yair Altman HAN, Qun

WOW!

03 Jul 2009 FindJObj - find java handles of Matlab graphic objects Find java objects contained within a specified java container or Matlab GUI handle Author: Yair Altman Glavina, Leonardo

Great file! i just have one doubt using it: if I can chance the order of some structures. I have some check boxes and using 'tab' to select them is completely out of order, and using this function I found that it's following the specific order that is on the tree.

So, can I change the place of my tree's items?

thanks for the code

03 Jul 2009 EditorMacro - assign a macro to a keyboard key-stroke in the Matlab Editor and Command Window EditorMacro assigns a macro or action to requested key-binding in the Matlab Editor & Command Window Author: Yair Altman Shen, Jackson

I have tried again today. It "magically" works.
Yes, it does with with the Matlab R2008A.
I must say I love this feature.

02 Jul 2009 EditorMacro - assign a macro to a keyboard key-stroke in the Matlab Editor and Command Window EditorMacro assigns a macro or action to requested key-binding in the Matlab Editor & Command Window Author: Yair Altman Shen, Jackson

Exellent Work. It works with R2009A (Trial).
Brillian Features! (not for me at moment).
Unfornuately, it does not work with my R2008A.

18 Jun 2009 cprintf - display formatted colored text in the Command Window Displays sprintf-formatted strings in the Command Window using the specified color/underline style Author: Yair Altman Mike

18 Jun 2009 cprintf - display formatted colored text in the Command Window Displays sprintf-formatted strings in the Command Window using the specified color/underline style Author: Yair Altman Mike

There seems to be another bug, this one involving the '%' character. For example,

cprintf( 'keyword', '%% keyword\n' )

merely turns the command prompt (double chevron) blue, rather than printing '% keyword' and a newline character.

fprintf( '%% keyword\n' ), on the other hand, prints just what you would expect.

08 Jun 2009 ScrollPlot - scrollable X/Y axes ScrollPlot adds a scroll sub-window to any supplied plot handles. Author: Yair Altman saucer, joe

Yair, i have a string of data and i want to look at it very close up.. and also want to scroll, but because of the close up specifications, i cant scroll because i cant get the mid blue pane

04 Jun 2009 cprintf - display formatted colored text in the Command Window Displays sprintf-formatted strings in the Command Window using the specified color/underline style Author: Yair Altman Altman, Yair

@Karl - this is a corollary of the known issue with non-newline-terminated strings. In this case, the initial fprintf() was non-newline-terminated, getting cprintf confused...

A workaround for this case is to simply use cprintf for the initial black text, instead of fprintf:

cprintf('text', 'Here: ');
cprintf('blue', 'Blue\n');

04 Jun 2009 cprintf - display formatted colored text in the Command Window Displays sprintf-formatted strings in the Command Window using the specified color/underline style Author: Yair Altman Karl

This is great! I wish Matlab documented its Java innards better. Anyway, there seems to be another small bug.

fprintf('Here: ')
cprintf('blue', 'Blue\n');

results in a blue underscore followed by the word 'Blue' in white (invisible on white background of my command window - but shows up when highlighted).

However, the same code as above, only using '-blue' instead of 'blue', works fine (gives the expected underlined blue text).

I'm using Matlab 2007b on a Linux box.

03 Jun 2009 cprintf - display formatted colored text in the Command Window Displays sprintf-formatted strings in the Command Window using the specified color/underline style Author: Yair Altman B, Alan

02 Jun 2009 ScreenCapture - get a screen-capture of a figure frame or component ScreenCapture gets a screen-capture of any Matlab GUI handle, or specified screen area rectangle Author: Yair Altman us

a very nice robot, which the FEX community has been looking for a long time...
two thoughts:
1) in interactive mode, the user looses the data if no output arg is selected, which may be a bit frustrating:
a) a warning(?)
b) a new figure displaying the result by default(?)
2) we've been using this approach, which may be a bit faster (depending on the size of the capture) by converting the planes in one shot using a macro...

% input
% xoff/yoff/xlen/ylen
% assign after loading java stuff...
     rob=Robot;
% macro
     conv=@(a,b,c) double(bitand(a,255^b))./255^c;
% capture screen contents at this pos
     rec=Rectangle(xoff,yoff,xlen,ylen);
     cap=rob.createScreenCapture(rec);
     dat=cap.getData;
     buf=dat.getDataStorage;
     buf=typecast(buf(:),'uint32');
     buf=reshape(buf,dat.getWidth,dat.getHeight).';
     mm=zeros([size(buf),3]);
     mm(:,:,3)=conv(buf,1,0); % bitand(buf,255^1)./255^0;
     mm(:,:,2)=conv(buf,2,1); % bitand(buf,255^2)./255^1;
     mm(:,:,1)=conv(buf,3,2); % bitand(buf,255^3)./255^2;
     mm=mm./255;
% ...for display in a regular figure
     figure;
     set(gca,'position',[0,0,1,1]);
     image(mm);
     axis image;
     axis off;

3) in principle, the robot itself can be used on any screen location; it would be nice - however, admittedly cumbersome - to add this feature

us

27 May 2009 cprintf - display formatted colored text in the Command Window Displays sprintf-formatted strings in the Command Window using the specified color/underline style Author: Yair Altman Altman, Yair

yes Petter - this is a known limitation of CPRINTF that is mentioned in its help section as well as the TODO list (at the bottom of the file). Unfortunately, it seems that if there is no space separator, then Matlab attempts to combine the adjacent style segments, thereby overrunning the first segment's style with the second's. Adding a separator solves this. If anyone finds a workaround I'll be happy to hear. Until then it's a small price to pay...

27 May 2009 cprintf - display formatted colored text in the Command Window Displays sprintf-formatted strings in the Command Window using the specified color/underline style Author: Yair Altman Petter

OK, I now think that may be required.

27 May 2009 cprintf - display formatted colored text in the Command Window Displays sprintf-formatted strings in the Command Window using the specified color/underline style Author: Yair Altman Petter

The function prints an extra white space after each string. Example:

str = 'Welcome!';
n = length(str);
for k = 1:n
    col = [k/n 0 0];
    cprintf(col,str(k));
end
fprintf('\n');

results in:
 W e l c o m e !

25 May 2009 Java-based data table Spreadsheet display/editing/sorting of data with multiple features Author: Yair Altman laurent

22 May 2009 SYSTRAY - set/get system-tray icons on your computer's desktop sets icons in the system-tray of your computer's desktop & enables setting/getting icon properties Author: Yair Altman Petter

The submission should be updated to fix the above mentioned problem.

22 May 2009 FindJObj - find java handles of Matlab graphic objects Find java objects contained within a specified java container or Matlab GUI handle Author: Yair Altman HAN, Qun

Great work, Yair! I have refferenced it in my spaces.
Only one suggestion: To be compatible with future versions of ML, the use of "JavaFrame" in your function should be avoid. The "JavaFrame" is a com.mathworks.hg.peer.FigurePeer Object, it can be easily obtained using a JAVA approach instead of the get(hfig,'JavaFrame'). For example, you can get if from the mde's Client.

15 May 2009 cprintf - display formatted colored text in the Command Window Displays sprintf-formatted strings in the Command Window using the specified color/underline style Author: Yair Altman Petter

I did not know this was possible

 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com