The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
 All Forums
 Origin Forum for Programming
 Forum for Origin C
 MATRIX errechnen

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
serga2112 Posted - 03/24/2005 : 07:35:04 AM
Origin Version (Select Help-->About Origin):
Operating System:

Liebe Freunde,

ich habe ein Problemm. Habe eine Tarix in ORIGIN 20x1340. Ich muus alle Zahle in jeder Spalte dieser Matrix zusammenaddieren und in einer 21-er Zeile abbilden, so, dass ich am Ende eine matrix 21x1340 habe. Bitte, helfen sie mir, das ORIGIN C - Programm muss nicht gross sein .

Danke.
1   L A T E S T    R E P L I E S    (Newest First)
easwar Posted - 03/24/2005 : 12:04:27 PM
Hello,

I translated your text from German to English using:
http://world.altavista.com/
and from what I read from the translation, you want the following:

Take a matrix that is (m rows x n cols) and make it a matrix with (m rows x n+1 cols) where the last col has the sum of cells in each row.

If this is what you want, here is code to do that.

Otherwise, please post again, and if possible, in English.

Easwar
OriginLab


void matrix_add_sum_column(string strMat)
{
// Declare matrix object with specified name and check validity
// Note: It is assumed here that the matrix is of type double
Matrix Mat(strMat);
if( !Mat )
{
printf("Invalid matrix: %s\n", strMat);
return;
}

// Create an new matrix and copy data from Original matrix;
matrix mat;
mat = Mat;

// Transpose new matrix, do sum and store in vector
// (Need to transpose because only SumColums method available now
// and no SumRows)
mat.Transpose();
vector vecSum;
mat.SumColumns(vecSum);

// Increase dimension of original matrix by one column,
// keeping orignal data where it is
int nRows, nCols;
nRows = Mat.GetNumRows();
nCols = Mat.GetNumCols();
Mat.SetSize(nRows, nCols + 1, TRUE);

// Copy summed vector to last column
Mat.SetColumn(vecSum, nCols);
}



The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000