OneStopGate.Com
OnestopGate   OnestopGate
   Friday, May 3, 2024 Login  
OnestopGate
Home | Overview | Syllabus | Tutorials | FAQs | Downloads | Recommended Websites | Advertise | Payments | Contact Us | Forum
OneStopGate

GATE Resources
Gate Articles
Gate Books
Gate Colleges 
Gate Downloads 
Gate Faqs
Gate Jobs
Gate News 
Gate Sample Papers
Training Institutes

GATE Overview
Overview
GATE Eligibility
Structure Of GATE
GATE Coaching Centers
Colleges Providing M.Tech/M.E.
GATE Score
GATE Results
PG with Scholarships
Article On GATE
Admission Process For M.Tech/ MCP-PhD
GATE Topper 2012-13
GATE Forum




GATE 2025 Exclusive
Organizing Institute
Important Dates
How to Apply
Discipline Codes
GATE 2025 Exam Structure

GATE 2025 Syllabus
Aerospace Engg..
Agricultural Engg..
Architecture and Planning
Chemical Engg..
Chemistry
Civil Engg..
Computer Science / IT
Electronics & Communication Engg..
Electrical Engg..
Engineering Sciences
Geology and Geophysics
Instrumentation Engineering
Life Sciences
Mathematics
Mechanical Engg..
Metallurgical Engg..
Mining Engg..
Physics
Production & Industrial Engg..
Pharmaceutical Sciences
Textile Engineering and Fibre Science

GATE Study Material
Aerospace Engg..
Agricultural Engg..
Chemical Engg..
Chemistry
Civil Engg..
Computer Science / IT
Electronics & Communication Engg..
Electrical Engg..
Engineering Sciences
Instrumentation Engg..
Life Sciences
Mathematics
Mechanical Engg..
Physics
Pharmaceutical Sciences
Textile Engineering  and Fibre Science

GATE Preparation
GATE Pattern
GATE Tips N Tricks
Compare Evaluation
Sample Papers 
Gate Downloads 
Experts View

CEED 2013
CEED Exams
Eligibility
Application Forms
Important Dates
Contact Address
Examination Centres
CEED Sample Papers

Discuss GATE
GATE Forum
Exam Cities
Contact Details
Bank Details

Miscellaneous
Advertisment
Contact Us


Home » GATE Study Material » Electrical Engineering » Digital Signals and Data Representation » Data Files - File Format

Digital Signals and Data Representation

Looking for GATE Preparation Material? Join & Get here now!

** Gate 2013 Question Papers.. ** CEED 2013 Results.. ** Gate 2013 Question Papers With Solutions.. ** GATE 2013 CUT-OFFs.. ** GATE 2013 Results.. **

Data Files - File Format

Data Files - File Format



File Formats

When you write data to a file, you want that data to be in a format that can be read by other programs. Programs you might use are:

  • Mathcad,
  • Matlab
  • Spreadsheets
  • etc,
All of these programs can read the same kind of simple file. Note, that the files we are talking about here are not typical spreadsheet files that contain formatting and formulas and other things that allow the spreadsheet to make calculations, and present your data in graphs, etc. Those files are more complex, and are much more bloated (larger file size) that what we are talking about here.

Here, we are talking about very simple files that contain nothing about the data. When you are talking about simple files there are only a few considerations.

  • Data is almost always organized in rows and columns, so there will have to be ways of marking the end of one data point and the beginning of the next (some sort of column marker or delimiter).
  • Data is almost always saved as character strings. If you have numerical data that you want to save, (and you may have worked hard to get it into numerical format when it started life as a character string) you will need to convert it into a character string format before you can save it.
With those considerations, then, a data file might consist of the following characters.
0
.
0
/t
2
.
1
/r
/n
0
.
1
/t
2
.
5
/r
/n
etc.

This file would encode the data that would appear in a spreadsheet looking like this.


0.0
2.1
0.1
2.5
etc.

Notice how the data appears in this tab-delimited file.

  • The first three characters give the 0.0 in the upper left spreadsheet cell.
  • The tab (/t as an escape sequence) delimits the first column from the second.
  • The next set of characters gives the 2.1 - the data in the second column.
  • The carriage return and line feed take you to the second row in the table where the same pattern is repeated.
This pattern repeats for the rest of the data in the file. The only thing that's not covered by this is an EOF (End-Of-File) marker that is used to indicate the end of the file.

A Note On File Sizes

The information above can allow you to calculate or estimate file sizes. You can compute the number of characters in a row, and multiply by the number of rows. Here's an example.

Assume you have data in this format:

xx.yyy xxxx.yy xxxx.yy

  • This format has:
    • 6 characters in the first column,
    • Then a tab character to separate columns,
    • 7 characters in the second column,
    • Another tab character,
    • 7 characters in the third column,
    • And - finally - a carriage return and a line feed.
  • That's 24 characters in a row
  • If you have 100 rows, you would need 2400 bytes (one byte per character) to store this data in a file.

Formatting File Data

When you print data to a file, you usually want to control the format of the data you write. To do that you need to know how to use format strings. Format strings specify how data is stored. Let's examine a few.

  • %f
    • Data is a floating point number and will be stored as a floating point number with a decimal point - but no exponential.
  • %5.3f
    • Data is a floating point number and will be stored as a floating point number with a decimal point. There will be a total of five characters with three characters to the right of the decimal point. (So, there can be only one character to the left of the decimal point. You can't use this for 98.666, for example.)
  • %8.4f
    • Data is a floating point number and will be stored as a floating point number with a decimal point. There will be a total of eight characters with four characters to the right of the decimal point. (So, there will be three characters to the left. 98.666 will be stored with a space padding the left side.)



Discussion Center

Discuss/
Query

Papers/
Syllabus

Feedback/
Suggestion

Yahoo
Groups

Sirfdosti
Groups

Contact
Us

MEMBERS LOGIN
  
Email ID:
Password:

  Forgot Password?
 New User? Register!

INTERVIEW EBOOK
Get 9,000+ Interview Questions & Answers in an eBook. Interview Question & Answer Guide
  • 9,000+ Interview Questions
  • All Questions Answered
  • 5 FREE Bonuses
  • Free Upgrades
GATE RESOURCES
 
  • Gate Books
  • Training Institutes
  • Gate FAQs
  • GATE BOOKS
     
  • Mechanical Engineeering Books
  • Robotics Automations Engineering Books
  • Civil Engineering Books
  • Chemical Engineering Books
  • Environmental Engineering Books
  • Electrical Engineering Books
  • Electronics Engineering Books
  • Information Technology Books
  • Software Engineering Books
  • GATE Preparation Books
  • Exciting Offers



    GATE Exam, Gate 2009, Gate Papers, Gate Preparation & Related Pages


    GATE Overview | GATE Eligibility | Structure Of GATE | GATE Training Institutes | Colleges Providing M.Tech/M.E. | GATE Score | GATE Results | PG with Scholarships | Article On GATE | GATE Forum | GATE 2009 Exclusive | GATE 2009 Syllabus | GATE Organizing Institute | Important Dates for GATE Exam | How to Apply for GATE | Discipline / Branch Codes | GATE Syllabus for Aerospace Engineering | GATE Syllabus for Agricultural Engineering | GATE Syllabus for Architecture and Planning | GATE Syllabus for Chemical Engineering | GATE Syllabus for Chemistry | GATE Syllabus for Civil Engineering | GATE Syllabus for Computer Science / IT | GATE Syllabus for Electronics and Communication Engineering | GATE Syllabus for Engineering Sciences | GATE Syllabus for Geology and Geophysics | GATE Syllabus for Instrumentation Engineering | GATE Syllabus for Life Sciences | GATE Syllabus for Mathematics | GATE Syllabus for Mechanical Engineering | GATE Syllabus for Metallurgical Engineering | GATE Syllabus for Mining Engineering | GATE Syllabus for Physics | GATE Syllabus for Production and Industrial Engineering | GATE Syllabus for Pharmaceutical Sciences | GATE Syllabus for Textile Engineering and Fibre Science | GATE Preparation | GATE Pattern | GATE Tips & Tricks | GATE Compare Evaluation | GATE Sample Papers | GATE Downloads | Experts View on GATE | CEED 2009 | CEED 2009 Exam | Eligibility for CEED Exam | Application forms of CEED Exam | Important Dates of CEED Exam | Contact Address for CEED Exam | CEED Examination Centres | CEED Sample Papers | Discuss GATE | GATE Forum of OneStopGATE.com | GATE Exam Cities | Contact Details for GATE | Bank Details for GATE | GATE Miscellaneous Info | GATE FAQs | Advertisement on GATE | Contact Us on OneStopGATE |
    Copyright © 2024. One Stop Gate.com. All rights reserved Testimonials |Link To Us |Sitemap |Privacy Policy | Terms and Conditions|About Us
    Our Portals : Academic Tutorials | Best eBooksworld | Beyond Stats | City Details | Interview Questions | India Job Forum | Excellent Mobiles | Free Bangalore | Give Me The Code | Gog Logo | Free Classifieds | Jobs Assist | Interview Questions | One Stop FAQs | One Stop GATE | One Stop GRE | One Stop IAS | One Stop MBA | One Stop SAP | One Stop Testing | Web Hosting | Quick Site Kit | Sirf Dosti | Source Codes World | Tasty Food | Tech Archive | Software Testing Interview Questions | Free Online Exams | The Galz | Top Masala | Vyom | Vyom eBooks | Vyom International | Vyom Links | Vyoms | Vyom World
    C Interview Questions | C++ Interview Questions | Send Free SMS | Placement Papers | SMS Jokes | Cool Forwards | Romantic Shayari