title: Sending a Matlab Image to an Android tablet
body: <p>I have developed an Android app that connects with a laptop running Matlab over Bluetooth SPP.  I am able to send strings back and forth easily and I am now interested in sending an image from Matlab to display on tablet (48x64 grayscale would be sufficient).  I am unsure how to package an image and send it over at Matlab serial port. I am guessing you cannot just use fprintf or fwrite. </p>
  
  <p>This is what I think the Android side might look like</p>
  
  <pre><code>public void drawImage(byte[] buffer){
      ImageView camView = (ImageView)findViewById(R.id.camView);
      Bitmap myBitmap = BitmapFactory.decodeByteArray(buffer, 0, buffer.length);  
      Log.d(TAG,"decoded image");
      if(myBitmap != null){
      camView.setImageBitmap(myBitmap);
      Log.d(TAG,"Trying to display...");
      }
      else{
          Log.d(TAG, "Bitmap = null");
      }
  }// end drawImage
  </code></pre>
  
  <p>Any advice on either the Andriod or Matlab side would be greatly appreciated. Thanks!</p>