We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

supplying range data

Using QuickCalc, this does not work: str = "CHITEST({58,35;11,25;10,23},{45.35,47.65;17.56,18.44;16.09,16.91})"; res = Convert.ToDouble(qc.ParseAndCompute(str)); whereas the same string above (with prepended equal sign) works in Excel, as this is identical data to their example (I just used direct entry as opposed to cell ranges). 1) Please provide the ability to pass a literal array (in this case, a matrix). 2) How might I easily and efficiently (i.e. I don''t want to have to create a spreadsheet) work around this limitation? Thanks, Greg

6 Replies

AD Administrator Syncfusion Team November 30, 2004 08:46 AM

Cuurently, Essential Calculate does not support Matrix functions or notation. So, using braces in an argument list is not supported. We will add code to notify you of this limitation if you try to use such notation.


AD Administrator Syncfusion Team November 30, 2004 10:25 AM

Thanks for responding, Clay. So, how do I get this function and example parameters working (as simply as possible)? It seems that QuickCalc is not capable of doing it.? Might you have an example of a simple way of calculating with arrays?


AD Administrator Syncfusion Team November 30, 2004 11:34 AM

I do not have a sample for this. You would have to register a custom function that ''understands'' a string argument containing braces, and then either do the calculation yourself, or transform the brace arguments into arguments that some library function can understand. I will see if I can write up such a sample, but it will likely be tomorrow before I can get to it.


AD Administrator Syncfusion Team November 30, 2004 11:48 AM

I''m not asking how to get the brace parsing done - that''ll be a job for the next version of Calculate, I presume. I want to know how to calculate with a range of data. I tried making a CalcSheet, but don''t know how to make the calculate happen. Ex: CalcSheet cs = new CalcSheet(8,2); cs[1,1] = 58; cs[1,2] = 35; cs[2,1] = 11; cs[2,2] = 25; cs[3,1] = 10; cs[3,2] = 23; cs[6,1] = 45.35; cs[6,2] = 47.65; cs[7,1] = 17.56; cs[7,2] = 18.44; cs[8,1] = 16.09; cs[8,2] = 16.91; // cs[4,1] = "=ChiTest(A1:B3,A6:B8)"; // res = Convert.ToDouble(cs[4,1]); res = Convert.ToDouble(cs.Engine.ComputeChitest("A1:B3,A6:B8"));


AD Administrator Syncfusion Team November 30, 2004 06:14 PM

You need to add the CalcSheet to a CalcWorkBook and allow Calculations. CalcSheet cs = new CalcSheet(8,2); CalcWorkbook wb = new CalcWorkbook(new CalcSheet[]{cs}, new Hashtable()); cs.CalculationsSuspended = false; cs[1,1] = 58; cs[1,2] = 35; cs[2,1] = 11; cs[2,2] = 25; cs[3,1] = 10; cs[3,2] = 23; cs[6,1] = 45.35; cs[6,2] = 47.65; cs[7,1] = 17.56; cs[7,2] = 18.44; cs[8,1] = 16.09; cs[8,2] = 16.91; cs[4,1] = "=ChiTest(A1:B3,A6:B8)"; this.label1.Text = cs[4,1].ToString(); One other comment is that ChiTest is terribly slow in the code you have. It will about 10-20 seconds to return a value. It is by far the slowest calculation (probably 20-40 times slower than the next slowest formula). We will tweak this calculation for the release.


AD Administrator Syncfusion Team December 1, 2004 02:10 PM

Thanks Clay, that single workbook line was the missing piece. I''ll now be able to use this style whenever dealing with a range of data. Hopefully the range syntax at the top of this post will be given serious consideration. (and some day this forum will accept single apostrophes!)

Loader.
Live Chat Icon For mobile
Up arrow icon