One way to do so would be for you to generate the C++ code out of Matlab code using Matlab coder, then there are a few way ways to run C/C++ codes in the browser, see below links:
Running C in A Browser and Native client
It is worthwhile to mention that it might not be the best idea and you might face many fundamental issues since you are practically converting Matlab code two times to different programming languages. Currently, there are many issues with Google Native Client, including the fact that you can not run it on every browser, other services are essentially better than the google native client.
Finally, if you have a simple code I would recommend you to rewrite it in JS instead of going throw all the trouble.