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
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 LabTalk Forum
 Normalising the data
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Marin Vojkovic

Croatia
7 Posts

Posted - 10/30/2013 :  09:36:18 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): v7.0552(B552)
Operating System: Windows XP

How to divide all the columns in a worksheet by the max value of each column?
This is what I have so far:

win -a LID; //make the worksheet active

loop(ii, 2, 45) //looping trough columns
{

mc=max(wcol(ii)); // max of the column

LIDnorm_[ii] = wcol(ii)/mc; //this is the part I'm unsure of...
}

so, how do I get it to write the new data to columns on the new worksheet (LIDnorm)?

Thank you in advance for any help with this.

greg

USA
1379 Posts

Posted - 10/30/2013 :  09:48:55 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
This works in most versions of Origin:

loop(ii,2,wks.ncols)
{
wcol(ii) /= max(wcol(ii));
}

Not sure about version 7's handling of vector division ..

Edited by - greg on 10/30/2013 09:49:10 AM
Go to Top of Page

Marin Vojkovic

Croatia
7 Posts

Posted - 10/30/2013 :  10:15:49 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
nope...
it just puts 1 everywhere, except in the cells where the value was 0 - it makes them blank.

I would like 0 to stay 0, and everything else in the column to be divided by the max of the column.

Go to Top of Page

greg

USA
1379 Posts

Posted - 10/31/2013 :  09:11:07 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
This should do it:

loop(ii,2,wks.ncols)
{
sum(wcol(ii));
dMax = sum.max;
wo -s ii 0 ii 0;
%C/dMax;
}
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000