COMPGROUPS.NET | Search | Post Question | Groups | Stream | About | Register

### Sum of a cell

• Email
• Follow

http://www.sendspace.com/file/xeorjs
Open that in matlab and it will be stored into the workspace

I'm suppose to add all the elements in y and give the sum.

would it be like sum(y)

but i tried that and it doesnt work ?

 0
Reply Judas 4/7/2010 7:03:06 PM

See related articles to this posting

How about just typing in a simple example which represents your problem, rather than asking strangers to trust that you aren't having them download something malicious?

A = {1 2 3 4};  % Does your data look like that?

sum([A{:}])  % If so.

 0
Reply Matt 4/7/2010 7:09:10 PM

Sorry it's like this

myCell = cell(1,3)

myCell{1,1} =[1,4,-10;]

myCell{1,2} =[9,5,3,8,9,2,1,0,8,9,3,5,0,7,2,5,1,0,5,9,6,5,1,1,0,2,2,9,4,9,1,7,3,2,0,3,2,7,6,5,5,2,6,9,2,6,8,3,4,6,4,5,6,1,8,4,5,2,5,8,7,3,8,6,1,6,0,3,4,6,7,9,4,6,4,1,8,4,3,5,0,5,9,8,5,3,2,0,0,2,7,3,4,8,1,9,0,2,6,5;]

myCell{1,3} = [25,21,35,29,99,69;1,56,62,54,3,94;92,4,45,83,2,91;61,3,9,65,58,100;59,90,21,28,26,63;82,80,66,18,98,65;65,62,31,44,80,56;44,86,83,24,65,96;]

"Matt Fig" <spamanon@yahoo.com> wrote in message <hpil8l$grh$1@fred.mathworks.com>...
> How about just typing in a simple example which represents your problem, rather than asking strangers to trust that you aren't having them download something malicious?
>
> A = {1 2 3 4};  % Does your data look like that?
>
> sum([A{:}])  % If so.

 0
Reply Judas 4/7/2010 7:34:07 PM

O.k., so now you need to specify whether or not you need some sort of 'grand total', or just the sum of elements in each cell.  This is because the SUM function behaves differently for different sizes of inputs.

myCell = {magic(4), [1 2 3], [7;8;9], rand(6,7)}  % A simple example.

sum(cellfun(@(x) sum(x(:)),myCell))  % Grand total over all

cellfun(@sum,myCell,'Un',0)  % Simple application of SUM for each cell

cellfun(@(x) sum(x(:)),myCell)  % Grand total over all elements of each cell

 0
Reply Matt 4/7/2010 7:43:05 PM

3 Replies
404 Views

Similar Articles

12/6/2013 11:04:43 AM
page loaded in 29378 ms. (0)

Similar Artilces:

Cell to matrix
Hello, I want to askk how I can convert a 1xsomething cell array into a 1Xsomething matrix. Any help will be appreciated. Thank you sylar <fasih_m@hotmail.com> wrote in message <624501819.63697.1272898594598.JavaMail.root@gallium.mathforum.org>... > Hello, > > I want to askk how I can convert a 1xsomething cell array into a 1Xsomething matrix. > Any help will be appreciated. > Thank you a hint: - your your CELL array consists of numeric entries, only help cell2mat; % also, see help cat; us

Cell Segmentation
I am currently trying to segment the cells and then label them. I have done the segmentation on the cells using thresh and then later using a sobel to put the outline. But i have realized that the edges are not very defined and they are not closed up thus i am unable to do an imfill on it. I have actually tried imdilate to close the gaps but it is not possible because the lines seems to attach to another cell instead. What do you recommend to correct this or any new algorithms to solve this problem? Thanks for reading. On Apr 17, 4:08=A0am, "Roxy " <sufergal1...@hotmail.com> wrote: > I am currently trying to segment the cells and then label them. I have do= ne the segmentation on the cells using thresh and then later using a sobel = to put the outline. But i have realized that the edges are not very defined= and they are not closed up thus i am unable to do an imfill on it. I have = actually tried imdilate to close the gaps but it is not possible because th= e lines seems to attach to another cell instead. > What do you recommend to correct this or any new algorithms to solve this= problem? > > Thanks for reading

Cell mode: cell bound prompts figure output
Question 1. How many figures will show up in the HTML report when the following code is executed in cell mode? %% figure plot(OverallRisk,OverallReturn,'k'), hold on plot(PortRisk,PortReturn,'LineWidth',3,'Color',[.8 .8 .8]), hold on %% xlabel('Portfolio risk, \sigma_{p}') ylabel('Portfolio return, r_{p}') %% xlim = [0 max(OverallRisk)]; ylim = [RisklessRate max(ExpReturn)]; axis([xlim ylim]) %% set(gcf,'color','white') title('Capital allocation line') (Answer: 4) Question 2: to Mathworks developers working on cell mode. Is this a sensible behavior? :) Dimitri, this is working as designed. At a cell break, any changed figures are snapshotted. What would you like to happen here?

help:change a cell data.
hallo,please i need your help, I want to modify a content of a cell . x='11011011' ( class(x) is cell ) how can I put in every 1 a number 2,so at the end i have x='22022022' "isabelle robitaille" <isabelle.robitaille@yahoo.fr> wrote in message <hnlb1g$i0u$1@fred.mathworks.com>... > hallo,please i need your help, > I want to modify a content of a cell . > x='11011011' ( class(x) is cell ) > how can I put in every 1 a number 2,so at the end i have > x='22022022' >> x = {'11011011'} x = '11011011' >> x = {strrep(x{1}, '1', '2')} x = '22022022' >> Good Luck, Donn

How to Program for Cell Phones?
Hello, I'm new to this topic, so I'm not sure if this is the right place to put my questions, but here goes. I'm a software developer and am interested in writing some applications for cell phones, but I don't really know much more than that. Can anyone give me some advice on how to proceed? Basically: 1) What is the best software/cell phone platform to write for in terms of a large audience and growth potential? I hear a lot about Java for Cell Phones? Is this the best option, and what "versions", etc. would I need? 2) Since I don't need an actual cell phone service contract for this purpose, where could I purchase a "used" and "cheap" sell phone that I can run and test this software out on? 3) Are there any good books or Web Sites where I can learn about the pros/cons of programming for a cell phone? 4) Any other "advice" would be appreciated. Thanks... On 10 Mar 2006 11:58:11 -0800, samadams_2006@yahoo.ca wrote, quoted or indirectly quoted someone who said : >Can anyone give me some advice on how >to proceed? see http://mindprod.com/jgloss/cellphone.html and change links. -- Canadian Mind

clear cell array
Hello I'm running a for loop and in the for loop I create a cell array, I want to clear the content of the cell array at the end of each loop and start fresh in a new loop. Please someone help. Thanks Karabo "Karabo Magoro" <kmmagoro@yahoo.com> wrote in message <i9rrtb$7oi$1@fred.mathworks.com>... > Hello > I'm running a for loop and in the for loop I create a cell array, I want to clear the content of the cell array at the end of each loop and start fresh in a new loop. Please someone help. c(:) = {[]}; OR [c{:}] = deal([]); OR c = cell(size(c)); Bruno Thanks Bruno I used clear Nameofarray

Alternating colours in a table cell
Is there any way to make table cell's bgColor alternate, simulating a flashing effect? Trev wrote: > Is there any way to make table cell's bgColor alternate, simulating a > flashing effect? Yes. Richard. Richard Cornford wrote: > Trev wrote: > > Is there any way to make table cell's bgColor alternate, simulating a > > flashing effect? > > Yes. > > Richard. please elaborate!!!! Trev wrote: > Richard Cornford wrote: >> Trev wrote: >>> Is there any way to make table cell's bgColor alternate, simulating a >>> flashing effect? >> >> Yes. > > > > Richard. > > please elaborate!!!! An ability to use scripts to apply specific background colors to individual table cells implies an ability to alternate the colours used, both sequentially and with time. Richard. Trev a �crit : > Is there any way to make table cell's bgColor alternate, simulating a > flashing effect? > Arrrghhh ! beurk ! <td id="flashy" style="background:lime"> javascript in head : onload = function() { setInterval( function() { var flsh

remove NaN from cell
I need your help : I've got to remove nans from a 12x1 cell without reshaping if i try one of the solution suggested in this forum dd_m( all(cellfun(@isnan,dd_m ,'UniformOutput', false),2), : ) = []; the answer is: ??? Undefined function or method 'all' for input arguments of type 'cell'. Why? Please help me thank you mfrab "mf bruno" <mfbruno@email.it> wrote in message <gmu4bv$c9r$1@fred.mathworks.com>... > I need your help : > I've got to remove nans from a 12x1 cell without reshaping > if i try one of the solution suggested in this forum > > dd_m( all(cellfun(@isnan,dd_m ,'UniformOutput', false),2), : ) = []; > > the answer is: > ??? Undefined function or method 'all' for input arguments of type 'cell'. > > Why? > Please help me > thank you > mfrab You got me confused. How do you expect to remove things without reshaping? Perhaps you can give a small example of the expected input and output? A = {1 ; 2:10 ; repmat(3,3,3) ; NaN ; 5 ; 'text'} ; % a 6x1 cell with 1 NaN % -> B = {...} ?? Jos you're right!! let me explain: i've got

ATM Cell traffic
Hi I need to read ATM Cell traffic from a cisco 7500 router from mrtg, but I need to read not ip traffic but layer 2 traffic. I mean payload with ATM headers, Anybody know any MIB or Oid for that? Thanx Deniz

cell reuse script
Looking for a SKILL script that will look throughout the hierarchy tree to see where that cell is being used within the same library from current to bottom as well as current to top. Especially where used in different top level designs. Thankyou all in advance for any help in this matter. Regards, David Parmeter Hi cadman, This script will help you to search for thoughout hierarchy for particular cell. U can view the report from top to bottom or bottom to top as well. This has to use when your top cell view is open in active mode. How to use: -------------------- HowRepSubCell( "Library" "Cell" "View" ?disp "Bottom to Top") procedure( HowRepSubCell(lib cell view @key (cvid geGetEditCellView()) (file "/tmp/sub1.rep") (stopLib nil) (disp "Top to Bottom") "tttdtgt") let((sub outp subcellList (indent "") (flag nil) numb scc (listSoFar '()) (count 0) (subList nil) er banner