OK, I want to output a 200*200 array of integers in Octave (similar to Matlab) to a text file that Excel can read. When that works I want to reverse it and send a 200*200 array from Excel to Octave via text file.
First attempt – it outputted the whole array to the 200th column.
Second attempt – it outputted the whole array to the first row, instead of \n being used as a newline character it printed \n in every 201th column.
Third attempt try it on a 5*2 array – no output at all other than creating a blank file.
Fourth attempt try to output hello world to file – no output at all other than creating a blank file.
Command for 4th attempt.
fp1=fopen(“/home/david/Pictures/test.txt”,“w+”); # this works to the extent of creating a blank file in the right place
fprintf(fp1,“hello world”);
I’ve tried replacing double with single quotes, replacing w+ with w, adding a third argument in the fprintf statement, leaving off the final semicolon for each line, deleting the file test.txt, closing and reopening fp1.
When I left the ‘fp1’ out of fprintf for the third attempt it printed perfectly to standard output.
WTF. Have I somehow destroyed linux’s ability to write to files or something?
Starting with typing “octave &” from the terminal, what exactly do I have to do?