473,385 Members | 1,942 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Read Input File (matrix) C++

2
Hello guys,

I'm not very expert in programming stuff. I need your help.
I have to extract data from a file (signal.txt) where I have 2 columns and 100 rows. The first column is associated to time and the second one to a value of a function at this time. My goal is to import this data (maybe with fscanf but I don't know well the syntax) instant by instant inside a cycle for the time and store every time the value of the function.
Thanks
May 16 '07 #1
4 9065
gpraghuram
1,275 Expert 1GB
HI,
There are lots of posts in the forum which deals with this.
Better do a search to find one.
If u are still stuck then post here the issue and people here can help u out.
Thanks
Raghuram
May 16 '07 #2
weaknessforcats
9,208 Expert Mod 8TB
To get you started, if your are in C++, then don't use fscanf().

Use an ifstream object.
May 16 '07 #3
matkok
2
Thanks guys but I cannot find anything similar among these topics. I'm new in this forum also. So, do you think fscanf is not good for this application?
May 16 '07 #4
weaknessforcats
9,208 Expert Mod 8TB
The title of your posting is:
Re: How To Read Input File (matrix) C++
I see the word C++ there. So, use an ifstream object. fscanf() is the wrong choice. With fscanf() you can use only funcdamental types. You won't be able to use fscanf() with a user-defined type.
May 16 '07 #5

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

Similar topics

21
by: AnnMarie | last post by:
<script language="JavaScript" type="text/javascript"> <!-- function validate(theForm) { var validity = true; // assume valid if(frmComments.name.value=='' && validity == true) { alert('Your...
5
by: maxwell | last post by:
I used to program in matlab An read an image file with : fread(a,,0) which gave me a matrix of 256*256 full of numbers which were the pidxel values from 0 to 256. How do i do the same in c++ ...
1
by: bluekite2000 | last post by:
I have template <typename T> inline std::istream& operator >> (std::istream& is, Matrix<T>& mIn) { int rows,cols; is.clear(); is >> rows >> cols; mIn._M=rows; mIn._N=cols;...
2
by: jtan212 | last post by:
I am a c++ beginner. how can i read a *.sp file which discribe a schematic file,including subcircuits,resistance, capacitance and inductance, and then i need to turn the information i get to a...
8
by: a | last post by:
I have a struct to write to a file struct _structA{ long x; int y; float z; } struct _structA A; //file open write(fd,A,sizeof(_structA)); //file close
1
by: Jose Reckoner | last post by:
I'm running python 2.3 on Windows XP. Anyone have a quick small script to convert .DT1 and .DEM data to ASCII or some other format? I don't need a viewer. Thanks!
5
by: candexis | last post by:
Please, I will like to Know how to read and store a variable of 128 bits and the split it in 16 variables of 8 bits each, and then create a matrix of 4x4 using each block of 8 bits, for instance:...
23
by: bc90021 | last post by:
Hi All, Thanks in advance for any and all help! I have this code: g = open(fileName, 'a') where fileName is defined before the line it's used in. It works fine when I use it outside a...
1
by: csgirlie | last post by:
I'm trying to store or arrange three sets of two-dimensional data into three 2xN matrices that are stored as NumPy arrays. import os # for file handling functions import numpy as...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.