473,513 Members | 2,401 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Writing Matrix to a file

4 New Member
Hi guys i'm using C# and am having problems writing matrix output to either a text, csv or xls file. I've googled it and have seen different "suggestions" but i've tried most and they have not worked. can someone do a little example for me with maybe a 2by2 matrix so that i get something which works for my specific purpose.
Nov 8 '07 #1
6 1280
r035198x
13,262 MVP
Hi guys i'm using C# and am having problems writing matrix output to either a text, csv or xls file. I've googled it and have seen different "suggestions" but i've tried most and they have not worked. can someone do a little example for me with maybe a 2by2 matrix so that i get something which works for my specific purpose.
Can you write code that prints the contents of a 2x2 array to the console first?
Then try to write code that writes some lines to a file.
The rest should be as easy as addition.
Nov 8 '07 #2
peterchingo
4 New Member
Can you write code that prints the contents of a 2x2 array to the console first?
Then try to write code that writes some lines to a file.
The rest should be as easy as addition.
I have code which writes the matrix to the console and i only started experimenting with writing to a file last night but the problem is that when i try to write the matrix entries the stuff that is output in the file is gibberish. is this because i'm trying to use the wrong writer?? should i be using streamwriter as opposed to binarywriter or what??
Nov 8 '07 #3
r035198x
13,262 MVP
I have code which writes the matrix to the console and i only started experimenting with writing to a file last night but the problem is that when i try to write the matrix entries the stuff that is output in the file is gibberish. is this because i'm trying to use the wrong writer?? should i be using streamwriter as opposed to binarywriter or what??
What kind of data are you writing to the file?
If you are writing characters then you should be using the TextWriter class.
Nov 8 '07 #4
peterchingo
4 New Member
[quote=r035198x]What kind of data are you writing to the file?
If you are writing characters then you should be using the TextWriter class.

all the entries in the matrix are decimal numbers. i thought i could just use any writer to write them to a file without converting them to another format or is my thinking here wrong??
Nov 8 '07 #5
r035198x
13,262 MVP
[quote=peterchingo]
What kind of data are you writing to the file?
If you are writing characters then you should be using the TextWriter class.

all the entries in the matrix are decimal numbers. i thought i could just use any writer to write them to a file without converting them to another format or is my thinking here wrong??
Decimal numbers are characters so TextWriter will do. Binary data requires something else.
Can you post the code you used then?
Nov 8 '07 #6
peterchingo
4 New Member
[quote=r035198x]
Decimal numbers are characters so TextWriter will do. Binary data requires something else.
Can you post the code you used then?
i'm at work right now but i will send the code in 3 to 4 hours.
Nov 8 '07 #7

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

Similar topics

6
6564
by: memocan | last post by:
#include <iostream> using namespace std; int x; //global variable matrix int main() { x= new float ; //initialize the size now }
0
1721
by: Khadim | last post by:
Hi, I am facing a problem in my application. I have an image on which there are many numbers present. I can find the pixel position of the center of those numbers. Now I have the names of those...
20
5185
by: Frank-O | last post by:
Hi , Recently I have been commited to the task of "translating" some complex statistical algorithms from Matlab to C++. The goal is to be three times as fast as matlab ( the latest) . I've...
2
9337
by: jjiyunlee | last post by:
Hi, I'm new to C (and programming in general), and I have to say that this site has helped me learn a great deal about C (thanks everybody!!). I've looked through several discussions specifically...
1
3375
by: daneshjo | last post by:
Hi im an IT student.I have registered as a member of this site recently.I have a question about the solution of maze program. I want to write maze program in c++ .I want to solve the maze class...
2
8548
by: DarrenWeber | last post by:
Below is a module (matrix.py) with a class to implement some basic matrix operations on a 2D list. Some things puzzle me about the best way to do this (please don't refer to scipy, numpy and...
2
1723
by: Marco Biagioni | last post by:
After i've tried to update a vb 6.0 project to vb.net, using visual studio utility,i can't read correctly data bytes from a .bmp file to insert them in a matrix to operate on. Using vb 6.0 the...
2
2798
by: Marco Biagioni | last post by:
After i've tried to update a vb 6.0 project to vb.net, using visual studio utility,i can't read correctly data bytes from a .bmp file to insert them in a matrix to operate on. Using vb 6.0 the...
3
2199
by: craziileeboi | last post by:
Hi I have been pulling my hair out trying to figure this out. Please help!!! Here is my project description: By using a pointer to pointers **A and **B and the function calloc() allocate...
0
7264
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7386
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7543
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...
0
7534
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5094
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4749
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3236
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3226
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
805
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.