Matlab Serial Communication XBEE with LINUX - ttyUSB0 failure

Hi there,

i try to communicate with 2 zigbee 2.5 moduls between my laptop and a standalone arduino uno v3. i use ubuntu 12.04 (linux)

i configured the 2 zigbee moduls with xctu. everything works fine. i can send commands like +++ and get "OK" ...

i also can send with my stand alone arduino an "A" character and read with a Serial Monitor in linux an "A" (port: dev/ttyUSB0)

my big problem is, i cant get any connection with matlab when i use the zigbees (wireless).

first problem: i cant connect to ttyUSB0... only ttyS1 and ttyACM0 are available

something that works is: if i use an usb cable between arduino and linux i receive the "A" in matlab (port dev/ttyACM0)

the question is: why is ttyUSB0 working with the Serial Monitor, but not in Matlab why is ttyACM0 working with Matlab+Arduino(cable), but i cant reveive data with this port in Serial Monitor


what i did to solve the problem:

creating the all know java.opts file for matlab folder..... this helps to read data from arduino to matlab with usb cable.

i tried to redirect the usb ports: !sudo ln -s /dev/ttyACM0 /dev/ttyUSB0

here s my matlab code

%%
!sudo ln -s /dev/ttyS1 /dev/ttyACM0  

instrhwinfo('serial');
ports = ans.AvailableSerialPorts

pause(1);
clc

display(['Scanning...']);

s1 = serial('/dev/ttyACM0');    % define serial port ACM0 / USB0
s1.BaudRate=9600;               % define baud rate
set(s1, 'terminator', 'LF');    % define the terminator for println CR or LF
fopen(s1);




try                             % use try catch to ensure fclose
                                % signal the arduino to start collection
w=fscanf(s1,'%s')              % must define the input % d or %s, etc.
if (w=='A')
    display(['Collecting data']);
    fprintf(s1,'%s\n','A');     % establishContact just wants something to buffer
end




fclose(s1);
             
catch exception
    fclose(s1);
    delete(s1);
    clear s1;
    %freeserial;
end

is anybody out there who got the same problems? i dont know what to do right now...

this code is working with windows 7 and matlab.

%


instrhwinfo('serial');
ports = ans.AvailableSerialPorts

pause(1);
clc

display(['Scanning...']);

s1 = serial('COM4');    % define serial port ACM0 / USB0
s1.BaudRate=9600;               % define baud rate
set(s1, 'terminator', 'LF');    % define the terminator for println CR or LF
fopen(s1);




try                             % use try catch to ensure fclose
                                % signal the arduino to start collection
w=fscanf(s1,'%s')              % must define the input % d or %s, etc.
if (w=='A')
    display(['Collecting data']);
    fprintf(s1,'%s\n','A');     % establishContact just wants something to buffer
end




fclose(s1);
             
catch exception
    fclose(s1);
    delete(s1);
    clear s1;
    %freeserial;
end

so it seems the only problem are the usb ports. i have to define the right port to receive the data in matlab.