please help me to solve this issue

4 vues (au cours des 30 derniers jours)
jaah navi
jaah navi le 7 Déc 2017
Commenté : ANKUR KUMAR le 7 Déc 2017
could anyone can help me how to solve the issue
i want to add output_it(t,r,it).
where the value of output_it(t,r,it) is
output_it(:,:,1) =
[1.0e+16 *
0.0042 0.0633 0.0015 0.0099 0.0078;
0.0728 0.8843 2.8774 1.0145 1.0306;
0.7713 0.2718 0.4548 0.0162 0.0366;
0.0166 0.0114 0.0902 0.0087 0.0093;
0.0157 0.0375 0.0155 0.0042 0.0223;]
output_it(:,:,2) =
[1.0e+15 *
0.1940 0.0874 0.0481 0.1994 0.0927;
0.1135 0.0597 0.0507 0.0373 0.4475;
0.1277 0.9099 0.0948 0.1493 0.1414;
0.5734 1.8800 1.2900 0.2083 0.7211;
1.8153 2.6751 1.1576 9.5234 3.4484;]
output_it(:,:,3) =
[1.0e+15 *
2.5446 2.6430 1.1182 0.6000 0.0170;
0.2950 0.2830 0.0374 0.2028 0.0216;
0.4422 0.0303 0.0435 0.0796 0.1220;
1.9572 0.1589 0.5177 0.3122 0.3589;
0.1480 0.1326 0.0720 1.4849 0.0770;]
output_it(:,:,4) =
[1.0e+14 *
0.4818 0.3794 1.3795 0.2764 2.6247;
1.7508 2.9381 1.9491 1.5523 4.4306;
1.1985 0.5977 3.3783 1.4159 5.9268;
0.8402 2.4732 0.5696 0.7225 0.8774;
5.7730 4.4573 3.0514 7.0787 0.5669;]
output_it(:,:,5) =
[1.0e+16 *
0.0307 0.1335 0.2582 0.0972 0.0333;
1.8765 3.0360 0.5547 2.9308 4.7885;
0.8131 3.3146 0.1962 0.8415 0.1620;
0.0345 0.0712 0.0570 0.0196 0.0715;
0.0275 0.0775 2.1518 0.0995 0.0675;]
i need to sum output(t,r,it) so i used the command sum(output_it,5) but i unable to get the result.

Réponses (1)

ANKUR KUMAR
ANKUR KUMAR le 7 Déc 2017
Your matrices are in 3D. So if you want to add all along third dimension, so use
sum(output_it,3)
Suppose, your matrix having dimension 20*30*15
sum(A,3) gives a matrix of dimension 20*30
sum(A,2) gives a matrix of dimension 20*1*15
sum(A,1) gives a matrix of dimension 1*30*15
In the last 2 results, you can delete the unit dimension using permute or squeeze
  2 commentaires
jaah navi
jaah navi le 7 Déc 2017
i used the command sum(output_it,3) but its not giving the correct answer.
ANKUR KUMAR
ANKUR KUMAR le 7 Déc 2017
If your matrix contains some nan values, then you should to you use nanmean.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Creating and Concatenating Matrices dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by