471,066 Members | 1,287 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,066 software developers and data experts.

correlation coefficient prob...

hello everybody...i m a newbie and struggling with a small assignment which involves
1- creating a dynamic array for floating point numbers
2- comparing adjacent numbers and finding the CORRELATION COEFFICIENT....


can u tell me what functions to use so dat i can start of with?? i wud b rlyyyy grateful...thanxxx
Aug 19 '08 #1
7 1546
dlite922
1,584 Expert 1GB
do you know PHP?





Dan
Aug 19 '08 #2
i do know d basics but d prob is i dnt know how to create a dynamic array...1 dimensional dynamic array for entering float point numbers.....
Aug 20 '08 #3
r035198x
13,262 8TB
i do know d basics but d prob is i dnt know how to create a dynamic array...1 dimensional dynamic array for entering float point numbers.....
Start by reading a tutorial on PHP arrays ...
Aug 20 '08 #4
dlite922
1,584 Expert 1GB
i do know d basics but d prob is i dnt know how to create a dynamic array...1 dimensional dynamic array for entering float point numbers.....
here's a code to create any array:

[PHP]

//first create the array:
$myArr = array();

//to add a value to the array (push on top/end)
array_push($myArr,"value_here");

// to traverse your array, you can use a for loop
for($i = 0; isset($myArr[$i]); $i++)
{
echo "index $i contains " . $myArr[$i] . "<br />";
}



[/PHP]

With PHP you can mix the any type of variable in the array: you can have an array that contains text, integers , or any number, or boolean value.

Also you do not need to worry about the array size. that is automatically handled.

for more info, refer to:http://php.net/array


Good luck,





Dan
Aug 20 '08 #5
Atli
5,058 Expert 4TB
You shouldn't call array_push to add a single variable to an array.
It is a lot faster to do it like so:
Expand|Select|Wrap|Line Numbers
  1. $array[] = $someVar;
  2.  
array_push should only be used when you need to add multiple elements to an array.
Expand|Select|Wrap|Line Numbers
  1. array_push($array, $var1, $var2, $varN);
  2.  
Aug 20 '08 #6
Markus
6,050 Expert 4TB
Shouldn't that 'PLZ HELP..!!!' be removed?
Aug 20 '08 #7
Atli
5,058 Expert 4TB
Shouldn't that 'PLZ HELP..!!!' be removed?
Good point. It should, and it has been.

siddharthkumarr,

Please avoid putting phrazes like "plz help" in your thread titles. It makes it harder for the other members to spot problems they may be able to help with and it actually makes people less likely to read your thread.

Take a look at the Posting Guidelines please. It's all explained there.

MODERATOR
Aug 20 '08 #8

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by Pasi Havia | last post: by
1 post views Thread by Gary Wessle | last post: by
18 posts views Thread by robert | last post: by
2 posts views Thread by truthinlife | last post: by
9 posts views Thread by mail | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.