Thread Subject: Plotting a histogram taking particular cell values from multiple matrices

Subject: Plotting a histogram taking particular cell values from multiple matrices

From: Subrat Swain

Date: 26 Nov, 2008 18:43:02

Message: 1 of 2

Hi all,
I would like to code a program in MATLAB which will plot a histogram taking values from multiple matrices (a particular cell value from all matrices). For example I have 3 matrices (A,B and C). Each matrix is of order 3*3.
A = [1 2 3;4 5 6;7 8 9]
B = [12 13 14;16 18 21;23 25 28]
C = [46 23 16;12 31 33;32 34 54]

Now I want to code a program which will take the corresponding elements from these 3 matrices (for example A(1,1) - 1, B(1,1) - 12, C(1,1) - 46 ) and plot a histogram. Is it possible to put a loop which will internally take the corresponding elements from the matrices and plot a histogram. This is just an example while I have a large number of data sets which I will be using.

Appreciate for the help.

Thanks and Regards,
Subrat Kumar Swain.

Subject: Plotting a histogram taking particular cell values from multiple matrices

From: Ryan Ollos

Date: 28 Nov, 2008 10:50:17

Message: 2 of 2

"Subrat Swain" <swain.subrat01@gmail.com> wrote in message <ggk5bm$3tl$1@fred.mathworks.com>...
> Hi all,
> I would like to code a program in MATLAB which will plot a histogram taking values from multiple matrices (a particular cell value from all matrices). For example I have 3 matrices (A,B and C). Each matrix is of order 3*3.
> A = [1 2 3;4 5 6;7 8 9]
> B = [12 13 14;16 18 21;23 25 28]
> C = [46 23 16;12 31 33;32 34 54]
>
> Now I want to code a program which will take the corresponding elements from these 3 matrices (for example A(1,1) - 1, B(1,1) - 12, C(1,1) - 46 ) and plot a histogram. Is it possible to put a loop which will internally take the corresponding elements from the matrices and plot a histogram. This is just an example while I have a large number of data sets which I will be using.
>
> Appreciate for the help.
>
> Thanks and Regards,
> Subrat Kumar Swain.

Perhaps you can just use a 3-dimensional array. In your example this would give you a 3 x 3 x 3 array Z, and you could then pass Z(1,1,:) to histogram.

If you arrays are not all the same size, then you could put them in a cell array.

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

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.

rssFeed for this Thread
 

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