I ended up solving my problem. For future reference, if you are trying to use an I2C LCD with Arduino there's a couple of steps you have to follow.
- Install Matlab Arduino Hardware Support Packages
- Install Arduino IDE
- Find the correct port for your device on Windows (COM) or Mac (/dev/tty or /dev/cu)
- Install LiquidCrystal_I2C and find your I2C address
- Read the thread by Robin2 and use the code that matches your needs
- Search for fprintf_r and install in Matlab directory
- This snippet of code sends the heartrate to Arduino IDE
calculated_HR = 79.95;
heartrate=num2str(calculated_HR);
fprintf(arduino,heartrate);
fprintf_r('reset');
Two things to note: First, it's really important to convert your double to a string since Arduino will be receiving it as an array of characters. Second, fprintf_r is needed because it basically sends a carriage end to Arduino to signify that's the end of the transmission.
Hope this helps.