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
 Origin Forum
 compare matrices
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

freppie

Germany
1 Posts

Posted - 01/10/2012 :  10:27:00 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): 8.1 SR3
Operating System:Windows Xp professional

Hi!

I am new to origin and I am testing it out with some of my data where I need some help...

Basically I have 2 matrices of the same size and I want to create a new matrix where the highest value is taken and where I can get a percentage of how many samples that were taken from each matrix. So a nice if statement would be fine here (if mat1>mat2, then mat1 otherwise mat2) and I have been checking around and trying the "Set Values" function that can do many manipulations but not this what I can see. I am sure there is an easy answer to this for a newbie like me...

Thanks in advance and sorry for taking up your time!

Hideo Fujii

USA
1582 Posts

Posted - 01/11/2012 :  2:46:03 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

The following single command using the conditional operator in the 
Script window does the job: 

  Mbook3=mbook1>mbook2?mbook1:mbook2;

To count how many cells in MBook3 are equal to the cells in MBook1 
(assuming no same values common both in MBook1 and MBook2),
you can do the following (with a second intermediate matrix, Mbook4): 

  mbook4=(mbook3-mbook1)>0?0:1; //round up
  m2w method:=xyz;  //convert to a woksheet
  sum(col(C)); //get simple stats
  sum.N=;  //number of cells
  sum.total=;  //cells of 1
  sum.total/sum.N=;  //percent value

Hope this works for your task.

--Hideo Fujii
OriginLab
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