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:
Series of images in same axis in GUI

Subject: Series of images in same axis in GUI

From: Krishna Kumar

Date: 22 Jun, 2011 11:03:02

Message: 1 of 10

Hi all, I have a GUI which has a axes in it apart from other elements. The functions called in callbacks generate different figures, say 5 in number. I want to display them in the axes one by one,such that user can see the previous or next image by pushing two push buttons provided.
what i want is to allow user to go back and forth across a set of graphs generated, using two buttons 'prev' and 'next'. To put it clearly, the functions called in callbacks generate the plots which are displayed in the said axis as and when they are generated. Once the process stops, user should be able to view the plots in the same axes by using the 'prev' and 'next' buttons. What is the best way to do this? Thanks in advance.

Subject: Series of images in same axis in GUI

From: ImageAnalyst

Date: 22 Jun, 2011 11:25:50

Message: 2 of 10

I'd store them all (images plus graph data) in a structure array, and
then when the scroll bar is at a certain location, recall the
structure for that location (index). Or you could simply re-read in
the images and regenerate the graphs if that doesn't take too long.

Subject: Series of images in same axis in GUI

From: Krishna Kumar

Date: 22 Jun, 2011 11:36:04

Message: 3 of 10

ImageAnalyst <imageanalyst@mailinator.com> wrote in message <73c6e4e1-90b6-41f8-9fdd-60a1e5e73584@m10g2000yqd.googlegroups.com>...
> I'd store them all (images plus graph data) in a structure array, and
> then when the scroll bar is at a certain location, recall the
> structure for that location (index). Or you could simply re-read in
> the images and regenerate the graphs if that doesn't take too long.
I thought i would save them as .fig files. And load them onto the axes as per the user's desire. Is that the best way. If so how to do it ? Please help.

Subject: Series of images in same axis in GUI

From: Krishna Kumar

Date: 22 Jun, 2011 11:39:05

Message: 4 of 10

ImageAnalyst <imageanalyst@mailinator.com> wrote in message <73c6e4e1-90b6-41f8-9fdd-60a1e5e73584@m10g2000yqd.googlegroups.com>...
> I'd store them all (images plus graph data) in a structure array, and
Dear Image Analyst,
How do i store images/graphs in a struct array.

Subject: Series of images in same axis in GUI

From: ImageAnalyst

Date: 22 Jun, 2011 13:10:32

Message: 5 of 10

On Jun 22, 7:39 am, "Krishna Kumar" <skrishnakumar.ac...@gmail.com>
wrote:
> ImageAnalyst <imageanal...@mailinator.com> wrote in message <73c6e4e1-90b6-41f8-9fdd-60a1e5e73...@m10g2000yqd.googlegroups.com>...
> > I'd store them all (images plus graph data) in a structure array, and
>
> Dear Image Analyst,
> How do i store images/graphs in a struct array.

-------------------------------------------------------------
For each step, you could do something like
structData(1).image = myImageArray;
structData(1).xData = myXValues;
structData(1).yData = myYValues;
structData(1).textData = myString;
and so on for structData 2 through 5.
Or if all you want to show some plot in the same window, why can't you
just replot the data? Does it take minutes to plot?

Subject: Series of images in same axis in GUI

From: Krishna Kumar

Date: 23 Jun, 2011 03:49:04

Message: 6 of 10

> For each step, you could do something like
> structData(1).image = myImageArray;
> structData(1).xData = myXValues;
> structData(1).yData = myYValues;
> structData(1).textData = myString;
> and so on for structData 2 through 5.
> Or if all you want to show some plot in the same window, why can't you
> just replot the data? Does it take minutes to plot?
Dear I A,
        Thank you for the reply. I have a small doubt. How do I form the 'myImageArray' ? Should i do it through imread/ sth like that. How do I display it later. Please help in this regard.

Subject: Series of images in same axis in GUI

From: ImageAnalyst

Date: 23 Jun, 2011 03:57:03

Message: 7 of 10

Again, why can't you just replot the data?

myImageArray was just an example - it could be any numerical array
whatsoever. Maybe it is an image you got by calling getframe() or
getting the cdata property of your axes, or maybe it's not. What I
wanted to show you is that you can stuff whatever kind of stuff you
want into a structure that you can create dynamically. And you can
have an array of those structures - a bunch of them (with all the same
member name but different values) that you can access through an index.

Subject: Series of images in same axis in GUI

From: Krishna Kumar

Date: 23 Jun, 2011 04:21:04

Message: 8 of 10

ImageAnalyst <imageanalyst@mailinator.com> wrote in message <70e4ba2d-6ef1-40e8-9390-d9a4f7e15934@w4g2000yqm.googlegroups.com>...
> Again, why can't you just replot the data?
>
> myImageArray was just an example - it could be any numerical array
> whatsoever. Maybe it is an image you got by calling getframe() or
> getting the cdata property of your axes, or maybe it's not. What I
> wanted to show you is that you can stuff whatever kind of stuff you
> want into a structure that you can create dynamically. And you can
> have an array of those structures - a bunch of them (with all the same
> member name but different values) that you can access through an index.

Thanks a lot IA,
                     I can't replot because the plots are bit big. Also that would mean carrying huge amount of related data across functions.Anyhow I understand There is not a simpler way to do this. I also thought of saving the plots in .fig. How do I read them onto the axes I desire. I tried using hgload and open etc ,but could not plot onto the specific axes. Do yo have any suggestions.
Thanks again,
Krishna.

Subject: Series of images in same axis in GUI

From: ImageAnalyst

Date: 23 Jun, 2011 04:39:38

Message: 9 of 10

Why can't you use getframe and imwrite?

Subject: Series of images in same axis in GUI

From: Krishna Kumar

Date: 23 Jun, 2011 05:05:20

Message: 10 of 10

ImageAnalyst <imageanalyst@mailinator.com> wrote in message <7530b1e7-dffd-4fa2-948d-8106cf0c1f49@d1g2000yqm.googlegroups.com>...
> Why can't you use getframe and imwrite?
Dear IA,
          Thanks a million times. With 'getframe' I am able to achieve what I wanted.
F (i)= getframe(gcf);
This i would use whenever plots are generated.
image(F(i).cdata)
This I would use to display the plot as per the user's choice in the axis.
With This I am getting results nearly as I wanted.
Thanks again Image Analyst.
Regards,
Krishna

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