Thursday, November 20, 2008

File output and input in Matlab and C

Save matlab workspace variables to a text file
save('filename','variable_name','-ASCII');

Scan this file into a C program
int k1;
FILE *filename;
filename = fopen("filename","r");
for (k1 = 0; k1 < size; k1++)
fscanf(filename, "%f ", &var[k1]);
fclose(filename);

Saturday, November 15, 2008

Weird problems in C debugging

./opt1.sub.h: In function ‘tcf’:
./opt1.sub.h:234: error: stray ‘\357’ in program
./opt1.sub.h:234: error: stray ‘\274’ in program
./opt1.sub.h:234: error: stray ‘\213’ in program
./opt1.sub.h:234: error: expected ‘)’ before ‘zp’

I searched the web, the problem is"
It means you have some goofy characters on that line. They are probably invisible. Try deleting the line entirely and retyping it."----from cprogramming.com

Monday, November 10, 2008

Ubuntu Desktop Recover

Sometimes, when you install new programs on Ubuntu, you may fail to log into the graphic interface again.
In that case, you may try to reinstall ubuntu-destkop by
"sudo apt-get install ubuntu-desktop".
Generally, after rebooting, you will be able to access to the desktop again.
If "xorg.conf" under the /etc/ directory may be corrupted. You can use the backup from that directory by
"cp xorg.conf.backup xorg.conf"