Hi Javier,
From the GUI you can simply highlight/select all cols of the wks and then use the menu item Statistics->Descriptive Statistics->Statistics on Rows, which will generate a new worksheet with all stats for each row of the wks.
You could instead use the following script segment, which would add two cols to the end of the wks, and put the mean and sd value in those cols for the data in each row.
// Get num rows and cols of wks
ncols = wks.ncols;
nrows = wks.nrows;
// Add two cols at end for mean and sd
wks.addcol(Mean);
wks.addcol(SD);
// create temp dataset
temp={};
// set stats object to use temp dataset
stat.DS.data$=temp;
// loop over all rows
for(ir = 1; ir <= nrows; ir++)
{
// loop over all cols and fill temp
for(ic= 1; ic <= ncols; ic++)
{
temp[ic]=cell(ir,ic);
}
// do stats on temp
stat.DS();
// save mean and sd to last cols
cell(ir,ic)=stat.ds.mean;
cell(ir,ic+1)=stat.ds.sd;
}
// delete temp dataset
del temp;
As for matrix, you can access matrix cells with the cell(i,j) function as well. In the matrix case, you could decide where to put the stats results. For example it could go into a worksheet in which case you can look up script command to make a new wks and then put the stats results in there.
Easwar
OriginLab