Now the sad part is this all will work only in MATLAB 7.0 of greater version. now it is very simple. the following four lines will work to give you output.
open = daqhwinfo('parallel')
DIO1 = digitalio('parallel','LPT1');
DIO2 = digitalio('parallel','LPT1');
outreg = addline(DIO1, 0:7, 0, 'out');
inreg = addline(DIO2, 0:4, 1, 'in');
outreg is the variable in which output value will be put into by MATLAB and sent to ports and inreg is port to which the input value will be saved. now the '0:7' represents 8 pins of dataport and '0:4' represents 5 pins of status port.
putvalue(DIO1.Line(2),1) puts the value to line number "2" of the DIO1 configured port and the poutput value is 1.
getvalue(OBJ) will get the input value.