Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

How to import data from a .csv file to a matrix using C?

Status
Not open for further replies.

amun

Junior Member level 2
Joined
Feb 17, 2005
Messages
24
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,467
Thanks in advance.
I want to import data (consisting of numbers in type double) from a .csv file to a matrix in my C program.

Can anybody help me find or write the proper function? The function will be very similar to load() of MATLAB, but i need to create the one for C language.

Aydin.
 

umery2k75

Advanced Member level 1
Joined
Apr 19, 2006
Messages
425
Helped
41
Reputation
80
Reaction score
15
Trophy points
1,298
Location
Pakistan
Activity points
5,629
Re: C Question

Can you properly read the *.csv file extension. Can this file be opened with the Microsoft Notepad? I asked you so, because to be able to read it, you must know how the file is written. As long ago, I had seen the C program, that was capable of making the Acrobat file as an Output. So people can actually view the output graph, value, etc in the PDF format. So you must actually know how to tackle with the CSV extension.
Afterward, you need to make algoritm that would convert and do computations, as you like and in the end you have to decide what kind of output you want to have.
 

btbass

Advanced Member level 5
Joined
Jul 20, 2001
Messages
1,897
Helped
438
Reputation
880
Reaction score
287
Trophy points
1,363
Location
Oberon
Activity points
12,863
C Question

It should be quite easy. The file is a text file with comma seperated values. You just need to open the file, and parse the values using the commas as delimiters, then convert the assci values into doubles.
Any C tutorial wil have file I/O examples.

look in <stdio.h> and <stdlib.h> for the functions you need.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top