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
 Create matrix
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Andryusha

Ukraine
7 Posts

Posted - 02/10/2012 :  1:03:22 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): 8.5.1 sr2
Operating System: win7 64 bit

Dear all! Help me please: I have in Exel column with 10000 numbers. I need to make from it matrix with dimension 250 rows and 40 columns. Early (origin 7.0) from Origin i opened exel worksheet -> select this column with 10000 numbers and in menu Window (in Origin7) take Create matrix. So i recieved matrix with 1 column and 10000 rows/ Then in menu Matrix ->Set dimension i entered 250 rows and 40 columns and i reciewed full matrix with 10000 numbers. But now its not work :(
How I must do it???

Andryusha

Hideo Fujii

USA
1582 Posts

Posted - 02/10/2012 :  6:20:57 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Andryusha,

This is a bug which was at some point introduced. I have submitted to fix the 
problem in a new release (possibly ver. 8.6 SR2).
Meanwhile, you can use the following script to convert the 1-column matrix 
to MxN matrix: 

GetN (What is the number of Rows in Output?) nr;
range m1=1!1;
nw=m1.nrows;
//range wc=col(1) for wks
//nw=wc.GetSize() for wks
if((nw/nr)==int(nw/nr)) nc=nw/nr; 
else nc=int(nw/nr)+1;
window -t m;
range mm=1!1;
mm.ncols=nc;
mm.nrows=nr;
for(ii=1;ii<=nc; ii++) {
  for(jj=1;jj<=nr; jj++) {
    mm[jj,ii]=m1[nr*(ii-1)+jj];
  }
}

Note that the input data may be more convenient in a worksheet rather than 
in a matrix because as suggested in comment, the number of rows can be 
automatically obtained without bothering the empty cells below.

Hope this is helpful for you.

--Hideo Fujii
OriginLab

Edited by - Hideo Fujii on 02/10/2012 6:22:11 PM
Go to Top of Page

Andryusha

Ukraine
7 Posts

Posted - 02/11/2012 :  01:37:31 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank you Hideo!
I hope its script really help me. But I'm not powerful in programming so can you write then and where (at which stage) I need paste this script?

Sorry for my incompetence during workin with script :(

With best wishes Andryusha

Andryusha
Go to Top of Page

Hideo Fujii

USA
1582 Posts

Posted - 02/13/2012 :  3:53:10 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Andryusha,

No problem! Copy-and-paste all lines of the script into the Script window, then highlight all lines in the Script window, and press ENTER key to run the code. If you need the complete ways to run a script (e.g., to save the code in a script file, and run the file), you can go to the LabTalk help ("Help: Programming: LabTalk" menu), then go to the following section:

LabTalk Programming> Running and Debugging LabTalk Scripts> Running Scripts


Hope it works as you wanted.

--Hideo Fujii
OriginLab
Go to Top of Page

easwar

USA
1964 Posts

Posted - 02/14/2012 :  10:46:01 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

Here is perhaps a simpler way:

-> First create an empty matrix from the gui/menu and set its dimension by setting desired columns and rows.

-> Then run this code:


// point to excel column
// assuming that it is first col of 1st sheet of book2
range rexcel=[book2]1!1;
// point to the empty matrix you have created
// assuming that it is first matrix object in first sheet of mbook1 
range rmat=[mbook1]1!1;
// simply copy from excel column to matrix
// data will be filled in row-wise, so 1st row, then 2nd row etc
rmat=rexcel;


Easwar
OriginLab
Go to Top of Page

Andryusha

Ukraine
7 Posts

Posted - 02/15/2012 :  06:56:13 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by Hideo Fujii

Hi Andryusha,

No problem! Copy-and-paste all lines of the script into the Script window, then highlight all lines in the Script window, and press ENTER key to run the code.

Hope it works as you wanted.

--Hideo Fujii
OriginLab




Many thanks!!! It's that I needed!!!

Andryusha
Go to Top of Page

Andryusha

Ukraine
7 Posts

Posted - 02/15/2012 :  07:27:19 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by easwar

Hi,

Here is perhaps a simpler way:

-> First create an empty matrix from the gui/menu and set its dimension by setting desired columns and rows.

-> Then run this code:


// point to excel column
// assuming that it is first col of 1st sheet of book2
range rexcel=[book2]1!1;
// point to the empty matrix you have created
// assuming that it is first matrix object in first sheet of mbook1 
range rmat=[mbook1]1!1;
// simply copy from excel column to matrix
// data will be filled in row-wise, so 1st row, then 2nd row etc
rmat=rexcel;


Easwar
OriginLab


May be it's really easy, but I have problem with this technics :(
What I do no so? : I do next:
1. Open excel book from Origin (Book6). Columns have 11856 rows
2. create matrix (mbook3), then in Set Dimension I set 114 columns and 104 rows
3. Run script

range rexcel=[book6]1!1;
range rmat=[mbook3]1!1;
rmat=rexcel;


4. copy columns from excel book and paste to the matrix windows
As result I have filled only one column in matrix :(


Andryusha

Edited by - Andryusha on 02/16/2012 04:50:56 AM
Go to Top of Page

easwar

USA
1964 Posts

Posted - 02/16/2012 :  12:02:18 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Andryusha,

There is no step4 needed. The script will do the copying. Are you running the script properly?

-> copy and paste all lines of script into the script window
-> click and hold left mouse button and drag and select all lines of script
-> press enter to execute the selected lines

You can look at LabTalk scripting guide (help menu->Programming->LabTalk) to learn how to run script from various places, such as script window, in Origin.

Easwar
OriginLab
Go to Top of Page

Andryusha

Ukraine
7 Posts

Posted - 02/16/2013 :  10:43:08 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hideo Fujii Posted - 02/10/2012 : 6:20:57 PM

Hi Andryusha,

This is a bug which was at some point introduced. I have submitted to fix the
problem in a new release (possibly ver. 8.6 SR2).


I try evolution version of Origin9 but this bug present in it :( Or may be I'm wrong? I.e. I can't create matrix from 1 column with 2400 cell to matrix with 60 rows and 40 columns by changing Set dimension...


Andryusha
Go to Top of Page

snowli

USA
1397 Posts

Posted - 02/18/2013 :  4:07:30 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hello,

Your original bug is tracked in ORG-5037. We fixed it by adding a system variale @MDA in 9.0 and also 8.6 sr2. Somehow by default it is 1. So it still truncates.

Choose Window: Script window menu.
Then run
@MDA=0
to set it as 0.

Then it will bring back the old behavior.

I emailed the developers to check why it was not set to 0 as default.


Thanks, Snow

quote:
Originally posted by Andryusha

Hideo Fujii Posted - 02/10/2012 : 6:20:57 PM

Hi Andryusha,

This is a bug which was at some point introduced. I have submitted to fix the
problem in a new release (possibly ver. 8.6 SR2).


I try evolution version of Origin9 but this bug present in it :( Or may be I'm wrong? I.e. I can't create matrix from 1 column with 2400 cell to matrix with 60 rows and 40 columns by changing Set dimension...


Andryusha


Edited by - snowli on 02/18/2013 4:17:06 PM
Go to Top of Page

Andryusha

Ukraine
7 Posts

Posted - 02/19/2013 :  11:06:56 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Many thanks!!! But after restart Origin we must run @MDA=0 againe? So it is no big problem/// Thank you very much!!!

Andryusha
Go to Top of Page

snowli

USA
1397 Posts

Posted - 02/19/2013 :  11:19:55 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
You are very welcome.

Sorry that I forgot to mention we have Tools: System Variabls menu to change system variable settings.

But that dialog is controlled by an xml file and it has limitation so MDA can't be changed in that dialog.

Origin supports change system variable settings in ORGSYS.CNF file under the installed Origin exe folder.
Open ORGSYS.CNF.
At the end of the file, enter
@mda=0;
Save the file. //In Win7, you may need to first save it to documents folder and then copy it back to Origin exe folder.

From then on, @MDA will be 0 by default.

I have updated the jira to add a checkbox in Set Matrix Dimensions dialog to control truncate or rearrange data when changing matrix dimensions. Hopefully it will be done in next version 9.1.

Thanks, Snow Li
OriginLab Corp.


quote:
Originally posted by Andryusha

Many thanks!!! But after restart Origin we must run @MDA=0 againe? So it is no big problem/// Thank you very much!!!

Andryusha


Edited by - snowli on 02/19/2013 11:27:37 AM
Go to Top of Page

Andryusha

Ukraine
7 Posts

Posted - 02/20/2013 :  12:44:40 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Snowli, You are a Magician! I great full for you!!! Thank very much. Because it was a small inconvenience but it did not give me to sleep peacefully Thank you again!

Andryusha
Go to Top of Page

snowli

USA
1397 Posts

Posted - 02/20/2013 :  12:53:09 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank you very much.

We tried to keep on improving our software based on customer's feedback, including ease to use. I am glad to let you know that our developer has implemented radio buttons in Set Matrix Dimension and Labels dialog in 9.1 so it will be much easier then.

Welcome to give us feedbacks in the future.

Thanks, Snow Li
OriginLab Corp.

Edited by - snowli on 02/20/2013 1:19:10 PM
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