dimanche 20 novembre 2011

lancer matlab sur ubuntu 11.10

Je viens d'installer Matlab 2010a sur mon ubuntu  oneiric, mais au moment du lancement j'obtiens le message d'erreur suivant:
/usr/local/matlabR2010a/bin/util/oscheck.sh: 605: /lib/libc.so.6: not found
pour résoudre ce problème, il faudrait restaurer la librairie qui a été désinstallée durant la mise à jour d'ubuntu.  Pour ce faire, taper dans un terminal la commande suivante:
sudo ln -s /lib/i386-linux-gnu/libc-2.13.so /lib/libc.so.6
Et voilà :)

samedi 5 novembre 2011

Matlab: passing an input argument to a script

Assalamo 3alaykom :)

So, I had this routine to run in matlab and I got tired  copying and pasting all the code and then change the values of my variables, so I had to find an easy way  to get trough with this...the solution was clear and trivial just pass your variables as input argument to the script!!! Why didn't  think of it earlier :-/
Then came the syntax problem how do i do this in matlab?
After a quick google search this is what I found:
assume that we want to calculate "sqrt(x)", our script will look like this:
y=sqrt(x)
now we have 2 ways to pass the argument "x" to the script:

1- just type the value of "x" in the command window before running the script:
>>x=36;
>>scriptFileName

2- or, convert the script to a function by adding the folowing line to the beginning of your script:function y=scriptFileName(x)
then run your function on the command window as follows:
>> scriptFileName(36)

That's it: easy peasy lemon squeezy