Question: Programming in C: A test.csv file is given which contains control commands for a spaceship and temperatures measured by the spaceship. The spaceship can only

Programming in C:

A test.csv file is given which contains control commands for a spaceship and temperatures measured by the spaceship. The spaceship can only move in 2 dimensions, starts at position (0, 0) and points to the right. The .csv file contains three values separated by commas (,) for each of 50 time steps, each of which is one second long.

The test.csv file is formatted like this:

Acceleration, rotation, temperature 0.19552015426254446,-0.051836107230205146,21.379749020857663

Here is my code in C to read in the data: #include #include #include #include

char* read_file(char* filename) { FILE *fptr;

if ((fptr = fopen(filename,"r")) == NULL){ printf("Error! opening file"); exit(1); }

fseek(fptr, 0, SEEK_END); long size = ftell(fptr); fseek(fptr, 0, SEEK_SET);

char* fcontent = (char*)calloc(size, sizeof(char));

fread(fcontent, 1, size, fptr);

fclose(fptr);

return fcontent; }

Excercise: Visualize the measured temperatures as a slide-gram. As .svg, using LATEX (e.g. with PGFPlots). Can you add this to my C code?

The .svg file should look like this:

Programming in C: A test.csv file is given which contains control commands

30 25 20 wy 15 10 5 0 25 50 75 100 30 25 20 wy 15 10 5 0 25 50 75 100

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!