Account Options

  1. Sign in
Google Groups Home
« Groups Home
Message from discussion How do i create a loop for this?
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
us  
View profile  
 More options Jan 28 2009, 11:28 am
Newsgroups: comp.soft-sys.matlab
From: "us " <u...@neurol.unizh.ch>
Date: Wed, 28 Jan 2009 16:28:03 +0000 (UTC)
Local: Wed, Jan 28 2009 11:28 am
Subject: Re: How do i create a loop for this?
"Xiao"

> Is it possible to perform an addition of the content (content of row 3 col 3 + content of row 4 col 3) and display the results as well...

the LAST one of the solutions...

% the data
     c={
          [],[],[],[]
          [],[1,2],[],[-1,-2]
          [],[],[3,4],[-3,-4]
          [],[],[5,6],[]
     };
% the engine
     ix=sum(~cellfun(@isempty,c))<=1;
     c(:,ix)={[]};
     [rx,cx]=find(~cellfun(@isempty,c));
     cu=unique(cx);
     r=arrayfun(@(x) sum([c{:,x}]),cu);
% the result
     disp(r);
%{
      18 % col# 3
     -10 % col# 4
%}

us


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.