Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Plotting a histogram taking particular cell values from multiple matrices
Date: Fri, 28 Nov 2008 10:50:17 +0000 (UTC)
Organization: PhysioSonics Inc
Lines: 17
Message-ID: <ggoid9$922$1@fred.mathworks.com>
References: <ggk5bm$3tl$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1227869417 9282 172.30.248.38 (28 Nov 2008 10:50:17 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 28 Nov 2008 10:50:17 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1129061
Xref: news.mathworks.com comp.soft-sys.matlab:503623


"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.