| | |
C file input/output 2D arrays.
![]() |
•
•
Join Date: Apr 2004
Posts: 1
Reputation:
Solved Threads: 0
Hi there,
I am currently converting a matlab file to C, and need some help writing the data calculated in 2D arrays to files.
This is what i ahve done so far:
<snip>
File *U;
File *V;
File *X;
File *Y;
U = fopen("U.txt", "w");
V = fopen("V.txt", "w");
X = fopen("X.txt", "w");
Y = fopen("Y.txt", "w");
<snip>
float U[N][N];
<snip> Here i do some calculations to fill the array with the new values.
i am not too sure how to make it write to the file...i have done this so far..
for (int i=0; i<N-1; i++){
for(int j=0; j<N-1; j++){
fprintf(Uvalues,"\n",U);
}
}
to get the values of the 2D array U to write to the file.
Any help will be much appreciated..
Steven
I am currently converting a matlab file to C, and need some help writing the data calculated in 2D arrays to files.
This is what i ahve done so far:
<snip>
File *U;
File *V;
File *X;
File *Y;
U = fopen("U.txt", "w");
V = fopen("V.txt", "w");
X = fopen("X.txt", "w");
Y = fopen("Y.txt", "w");
<snip>
float U[N][N];
<snip> Here i do some calculations to fill the array with the new values.
i am not too sure how to make it write to the file...i have done this so far..
for (int i=0; i<N-1; i++){
for(int j=0; j<N-1; j++){
fprintf(Uvalues,"\n",U);
}
}
to get the values of the 2D array U to write to the file.
Any help will be much appreciated..
Steven
![]() |
Similar Threads
- File input output please help :( (C)
- Server file input? (Java)
- Writing a file input and output program. (C++)
- Getting all data from an input and output file (C++)
Other Threads in the C Forum
- Previous Thread: value of learning computer theory
- Next Thread: connection program for sybase
| Thread Tools | Search this Thread |
* adobe ansi api array arrays binarysearch calculate centimeter char character cm convert copyanyfile copypdffile cprogramme createcopyoffile createprocess() csyntax directory dynamic feet fflush file floatingpointvalidation fork forloop frequency getlasterror getlogicaldrivestrin givemetehcodez global graphics gtkgcurlcompiling gtkwinlinux hacking highest homework i/o inches incrementoperators intmain() iso km linked linkedlist linux linuxsegmentationfault list locate logical_drives loopinsideloop. lowest match matrix microsoft mqqueue mysql oddnumber odf open opendocumentformat openwebfoundation pattern pdf performance posix power program programming pyramidusingturboccodes read recursion recv recvblocked repetition reversing scanf scheduling segmentationfault send shape single socketprograming socketprogramming stack standard strchr string suggestions test unix urboc user variable voidmain() whythiscodecausesegmentationfault win32api windows.h windowsapi





