Hello,
I have a file containing some float data in the '.dat' format. I know the C code to read the file in and store it in an array and I am using the same - however, when I load the program on to my MSP430FR5994 launchpad - the program keeps running but fails to print anything in the console window. I read some past questions about how the format for a '.dat' file in CCS is different - specifically the header - but I haven't been able to find the exact documentation for the latest CCS which describes how I can re-structure my file so that it could be read correctly in the CCS and neither did I understand if that is the only change I need to make in my file.
I am attaching the '.dat' file and the code I am using to read the same for reference. If anyone could re-direct me to the requisite link, it would be extremely helpful. I will continue searching for it on the forum and if I do find it will update the post here accordingly. Thank you!!
float spectrum[1024]; FILE *sampleFile; // Pointer to the sample data file int i = 0; // Index counter - used to keep track of which data point is being read in unsigned int coeff; // Determine which MFCC coefficient to compute float mfcc_result; // Holds the value of the computed coefficient // printf("Sample is: %d", 4); // Test statement to check where the code stops working memset(spectrum, 0, sizeof(spectrum)); // Initialize the spectrum sampleFile = fopen("sample.dat","r"); // Open the sample spectrum data // Read in the contents of the sample file while(!feof(sampleFile)) { fscanf(sampleFile, "%f", &spectrum[coeff++]); // %f tells fscanf to read a float } fclose(sampleFile); for(i=0;i<13;i++) { printf("%d, %f", i, spectrum[i]); }