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
 Forum for Origin C
 simple math with wks
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

prgo

Posts

Posted - 11/29/2006 :  09:36:58 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Version (Select Help-->About Origin):
Operating System:winXP
i-m new here, and my problem is probably very stupid but...
the idea is: i have two wks, and create the third one.
the second column of the third wks is obtained just by multiplaying
two different columns.
here is my code:

void test ()

{

Worksheet wks1("correction");
Worksheet wks2("data");
Worksheet wks3;
wks3.Create();
wks3.GetPage().Rename("Results");

Dataset dsColA(wks1,0);
Dataset dsColB(wks1,1);
Dataset dsColF(wks2,5);
Dataset dsColAA(wks3,0);
Dataset dsColBB(wks3,1);

dsColAA = dsColA;
dsColBB = dsColF * dsColB;

}

the problem is, the "results" dataset with two columns is created, but with values only for the first column (dsColAA).
the values in dsColBB are not there (and they should be ranging from 1E-3 to 1E7)....

any suggestion would be great!!!!

prgo

Mike Buess

USA
3037 Posts

Posted - 11/29/2006 :  11:18:42 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi prgo,

Your function worked fine in my tests. The only reason I can think of why it might fail is if the "data" wks had less than 6 columns or the 6th column contained missing values.

Mike Buess
Origin WebRing Member
Go to Top of Page

prgo

Posts

Posted - 11/30/2006 :  07:30:11 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
i-m a "little" bit lost,
i tried with "fill column with", (all the columns in both wks)
and then everything is ok.
but when i try to do it with "my numbers" (experimental data)
i have the same problem...it does not multiplay for the second column of the wks3.

each column contains cca 3000 rows, could that be a problem, or it is about the values?

Go to Top of Page

zachary_origin

China
Posts

Posted - 11/30/2006 :  10:02:46 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi prgo,

Tested and worked fine for me, too.
If possible, would you mind sending the .opj file to us thru tech@originlab.com ?

Zachary
OriginLab Technical Services.
Go to Top of Page

prgo

Posts

Posted - 11/30/2006 :  11:07:20 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
thanks! i have sent it.

function looks like this:

void test ()

{

Worksheet wks1("correction");
Worksheet wks2("data");
Worksheet wks3;
wks3.Create();
wks3.GetPage().Rename("Results");

Dataset dsColA(wks1,0);
Dataset dsColB(wks1,1);
Dataset dsColF(wks2,5);
Dataset dsColAA(wks3,0);
Dataset dsColBB(wks3,1);

dsColBB.SetSize(dsColF.GetSize());

dsColAA = dsColA;
dsColBB = dsColF * dsColB;

GraphPage gr;
string strTemplate = "template.otp";
BOOL bOK = gr.Create(strTemplate, CREATE_VISIBLE);

if (!bOK)
return;

GraphLayer grlay = gr.Layers(0);
ASSERT(grlay.IsValid());
Curve cv("Results_b");
ASSERT(cv.IsValid());
bOK = 0 <= grlay.AddPlot(cv);
if (!bOK)
return;
grlay.Rescale();

}


and it works ok when i test it, but not with "my numbers" (which are in *.OPJ file)

Go to Top of Page

zachary_origin

China
Posts

Posted - 11/30/2006 :  9:31:02 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi prgo,

I looked into your opj file. The problem is: in worksheet "correction", there are rows with missing values after row 2048, then the size of dsColF is more than 2048. While in worksheet "data", there are exactly 2048 rows. So dsColF and dsColB have different size. After mannually deleting the rows with missing values, it works fine.
I will discuss with our developers to see if it is necessary to improve this to support multiply two vectors with different sizes. Thanks for reporting this.



Zachary
OriginLab Technical Services.
Go to Top of Page

prgo

Posts

Posted - 12/01/2006 :  05:21:40 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
thanks a lot!!!!
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