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
 Origin Forum
 How to normalize matrix?

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
vkatsap Posted - 06/12/2008 : 12:06:57 PM
Origin Version (Select Help-->About Origin): 7.5
Operating System: WinXp

I work with 256x256 numerical arrays, and transform them to matrices in Origin. I need to normalize matrix, and could not have done that within Set Matrix Values. Please help!
6   L A T E S T    R E P L I E S    (Newest First)
Deanna Posted - 05/18/2009 : 09:59:26 AM
Hi Thomas,

Easwar's script was designed to be run in the Script Window/Command Window.

You can make your matrix active. Paste the following into the Command Window (If it is not open, select Window: Command Window from the ORigin menu):

range rm=<active>;sum(rm);rm -= sum.min;rm /= (sum.max - sum.min);


Press ENTER to execute the script.

Deanna
OriginLab Technical Services
thomaspreuth Posted - 05/14/2009 : 04:38:43 AM
Sorry,
I still do not get it.
When i put your script into the set values window and let it run, nothing happens.

How exactly do you normalize the matrixes with its max value?
easwar Posted - 06/13/2008 : 9:56:20 PM
[quote]
Now that I have working Script window, how can I make a button out of it?
[quote]

Hi Vic,

Open programming help file in your 7.5 Origin (menu item Help->Programming) and look at the topic: Programming Guide->User-Interface Development->Toolbar Buttons

Easwar
OriginLab

vkatsap Posted - 06/13/2008 : 2:39:11 PM
Hi,
thanka, I've got it running. Now that I have working Script window, how can I make a button out of it?
many thanks, Vic

quote:

Hi,

You could run script such as below. You could then put such script in a custom/new toolbar button so you can just click that to run it on other matrices.


// Normalize to be between 0 and 1 in all cells
sum(%h);
[%h] -= sum.min;
[%h] /= (sum.max - sum.min);



In version 8, the matrix window can have more than one matrix sheet, and each matrix sheet can have more than one matrix object/array. So for O8, the code cannot use %h (window name), and need to refer to active matrix object like below:


range rm=<active>;
sum(rm);
rm -= sum.min;
rm /= (sum.max - sum.min);


Easwar
OriginLab


Edited by - easwar on 06/12/2008 11:09:54 PM

vkatsap Posted - 06/13/2008 : 08:41:13 AM
Hi Easwar, thanks for reply.
I tried your script, and it's zeroed my matrix. I think there's a slight misunderstanding here:

I need to normalize matrix to MAX value in array, so Matrix Set Values must do the following:

- find MAX cell value in 256x256 matrix;
-divide each cell value by this MAX value, and multiply it by 100 (as to convert into percentage)

could you please advise on this?

many thanks, Victor

quote:

Hi,

You could run script such as below. You could then put such script in a custom/new toolbar button so you can just click that to run it on other matrices.


// Normalize to be between 0 and 1 in all cells
sum(%h);
[%h] -= sum.min;
[%h] /= (sum.max - sum.min);



In version 8, the matrix window can have more than one matrix sheet, and each matrix sheet can have more than one matrix object/array. So for O8, the code cannot use %h (window name), and need to refer to active matrix object like below:


range rm=<active>;
sum(rm);
rm -= sum.min;
rm /= (sum.max - sum.min);


Easwar
OriginLab


Edited by - easwar on 06/12/2008 11:09:54 PM

easwar Posted - 06/12/2008 : 10:33:47 PM
Hi,

You could run script such as below. You could then put such script in a custom/new toolbar button so you can just click that to run it on other matrices.


// Normalize to be between 0 and 1 in all cells
sum(%h);
[%h] -= sum.min;
[%h] /= (sum.max - sum.min);



In version 8, the matrix window can have more than one matrix sheet, and each matrix sheet can have more than one matrix object/array. So for O8, the code cannot use %h (window name), and need to refer to active matrix object like below:


range rm=<active>;
sum(rm);
rm -= sum.min;
rm /= (sum.max - sum.min);


Easwar
OriginLab


Edited by - easwar on 06/12/2008 11:09:54 PM

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