| T O P I C    R E V I E W | 
               
              
                | gelokkir2 | 
                Posted - 03/16/2003 : 1:54:50 PM  Hi,  I have a worksheet which is for example 2x2 (2 columns and 2 rows) If I add a third column and row, how can I make origin to put the sums of the previous columns-rows in them? Please see below for an example of what I mean:
       5 10 ..15      6 11 ..17     .. ..     11 21  
  Thank you for your help. 
  | 
               
              
                | 2   L A T E S T    R E P L I E S    (Newest First) | 
               
              
                | gelokkir2 | 
                Posted - 03/22/2003 : 4:00:41 PM  Thank you very much! I'll try it now. | 
               
              
                | greg | 
                Posted - 03/20/2003 : 2:42:32 PM  I suspect you are thinking of an Origin worksheet as a spreadsheet, which is not a good idea. I think you will end up struggling with Origin rather than letting it work for you.
  You can get the sum of a column range as follows:
  begin = 1; // or whatever end = 3; // or whatever set col(1) -bs begin;set col(1) -es end;sum(col(1)); type Sum from $(begin) to $(end) is $(sum.total).;
  and of a row range with:
  startcolumn = 1; // or whatever endcolumn = 2; // or whatever row = 2; // or whatever sum = 0; loop(ii,startcolumn,endcolumn) {     sum += wcol(ii)[row]; }; type Sum from $(startcolumn) to $(endcolumn) is $(sum).;
  For your simple example:
  win -t data origin; col(1)={5,6}; col(2)={10,11}; wo -a 1; // Do the row sums loop(ii,1,2) {     sum = 0;     loop(jj,1,2) {         sum += wcol(jj)[ii];     }     wcol(3)[ii] = sum; } // Do the column sums set col(1) -bs begin;set col(1) -es end;sum(col(1)); set col(1) -e 3; col(1)[3] = sum.total; set col(2) -bs begin;set col(2) -es end;sum(col(2)); set col(2) -e 3; col(2)[3] = sum.total;
 
    | 
               
             
           | 
         
       
       
     |