access shell variable from Matlab

How can you access a shell variable from matlab code ?
export the variable in the shell…
test=’hello’
export test

in matlab:
[return,shellvariable] = system(‘echo $test’)
now the matlab variable shellvariable contains the value of the shell variable test