user20778: So I want to send some data from Matlab to Arduino. To verify that I am getting the correct data I am sending the data back to Matlab (since I get errors if I open the serial monitor, if there's an easier way to print debug messages let me know).
The problem is that I always get 48 back.
My matlab code:
arduino = serial('COM3','BaudRate',115200);
fopen(arduino);
fprintf(arduino,'%f',1);
fclose(arduino);

fopen(arduino);
disp(fscanf(arduino, '%f'))
fclose(arduino);

and my arduino code:
In the setup:
Serial.begin(115200);

In the loop:
delay(100);
myFunction();

In myFunction:
while(!Serial.available()>0)){}
int data = Serial.read();
Serial.println(data,DEC);

It seems like the 48 is an ascii code for something but it doesn't ever change when I change the 1 is the 3rd line of the matlab code to anything else.

user13432: 
Why am I always getting 48 with serial communication?

Your Arduino sketch (snippet) is reading a byte and writing the value, not the character. The value 48 in ASCII is the character '0'. 
The below loop() function will echo all the characters received. 
void loop()
{
  while (Serial.available()) {
     char c = Serial.read();
     Serial.println(c);
  }
}

This could be a good starting point when debugging what is actually written from MATLAB. 

20778: <p>So I want to send some data from Matlab to Arduino. To verify that I am getting the correct data I am sending the data back to Matlab (since I get errors if I open the serial monitor, if there's an easier way to print debug messages let me know).</p>

<p>The problem is that I always get 48 back.</p>

<p>My matlab code:</p>

<pre><code>arduino = serial('COM3','BaudRate',115200);
fopen(arduino);
fprintf(arduino,'%f',1);
fclose(arduino);

fopen(arduino);
disp(fscanf(arduino, '%f'))
fclose(arduino);
</code></pre>

<p>and my arduino code:</p>

<p>In the setup:</p>

<pre><code>Serial.begin(115200);
</code></pre>

<p>In the loop:</p>

<pre><code>delay(100);
myFunction();
</code></pre>

<p>In myFunction:</p>

<pre><code>while(!Serial.available()&gt;0)){}
int data = Serial.read();
Serial.println(data,DEC);
</code></pre>

<p>It seems like the 48 is an ascii code for something but it doesn't ever change when I change the 1 is the 3rd line of the matlab code to anything else.</p>
 13432: <blockquote>
  <p>Why am I always getting 48 with serial communication?</p>
</blockquote>

<p>Your Arduino sketch (snippet) is <a href="https://www.arduino.cc/en/Serial/Read" rel="nofollow">reading a byte</a> and writing the value, not the character. The value 48 in <a href="http://www.asciitabell.se/" rel="nofollow">ASCII</a> is the character '0'. </p>

<p>The below loop() function will echo all the characters received. </p>

<pre><code>void loop()
{
  while (Serial.available()) {
     char c = Serial.read();
     Serial.println(c);
  }
}
</code></pre>

<p>This could be a good starting point when debugging what is actually written from MATLAB. </p>
