adding elements of an array column wise and storing it in different array

8 vues (au cours des 30 derniers jours)
sneha sharma
sneha sharma le 8 Déc 2015
delay consists of some rows and columns.How to add its elements column wise and store it in another array with rows as earlier and column is 1

Réponses (1)

Shivam Chaturvedi
Shivam Chaturvedi le 8 Déc 2015
Modifié(e) : Shivam Chaturvedi le 8 Déc 2015
You can use the sum function ( Sum of Array Elements [link to doc page] ) and since you need to sum on the columns, you can specify the dim parameter (should be 2 in this case to sum up column wise).
columnwise = sum(arr,2) % will get the columns summed up. Result will be 1 column.

Catégories

En savoir plus sur Loops and Conditional Statements dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by