No BSD License  

Highlights from
sumall

1.0

1.0 | 2 ratings Rate this file 3 Downloads (last 30 days) File Size: 287 Bytes File ID: #7960

sumall

by Barun Singh

 

01 Jul 2005 (Updated 05 Jul 2005)

Sum of all elements in an N-dimensional tensor.

| Watch this File

File Information
Description

Given an N-dimansional tensor, this function will produce a single number that is the sum of all elements in that tensor.

If X is a
: vector, this is the same as sum(X)
: matrix, this is the same as sum(sum(X))
: 3-d tensor, this is the same as sum(sum(sum(X)))

and so on.

A very simple utlity, but is very handy for use with hig-dimensional tensors

MATLAB release MATLAB 7 (R14)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (2)
05 Jul 2005 Duane Hanselman

Instead of using EVAL, why not just replace this function with the one computation line

function y=sumall(x)
y=sum(x(:))

08 Sep 2005 Demyan .

See previous comment.

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
matrices Barun Singh 22 Oct 2008 07:52:06
sum Barun Singh 22 Oct 2008 07:52:06
sum all Barun Singh 22 Oct 2008 07:52:06
elements Barun Singh 22 Oct 2008 07:52:06
ndim Barun Singh 22 Oct 2008 07:52:06
matrix manipulation Barun Singh 22 Oct 2008 07:52:06

Contact us at files@mathworks.com