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