Click here to Skip to main content
15,888,340 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i have these values in csv file:

4.7,3.6,3.7,1.5
6.3,7.3,2.6,9.4
3.6,1.5,3.5,1.5
7.2,5.3,2.5,5.3

how can i store these values in 2 dimensional array
Posted
Comments
George Swan 22-Aug-15 2:53am    
I would suggest that you have a look at this article
http://www.codeproject.com/Articles/161465/Arrays-Basics-in-CSharpDotNetTech

1 solution

I'm not sure what your issue is ...

You declare and instantiate a 4 x 4 array of the appropriate data type - double ?
You declare and initialise an integer variable, for the row
You open, then read the file containing the values, line by line, maybe into a string
For each string holding a line of 'csv' values :-
a) you 'split' the line (hint) based on the ','
b) you loop through the split values and assign them to the columns for the current row, ie incrementing the column count from 0 to 3
c) you increment the row count
End-For

There's no error handling in the above - but its the gist of what you need to do - why don't you write some code and give it a go - its not hard - update your question with the code and any specific issues you have and you'll likely get more help
 
Share this answer
 
v2
Comments
CPallini 22-Aug-15 3:15am    
5.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900