09-25-2013 09:29 AM
Hello, all,
i m trying to write a VI according to my matlab file, now i m confused about "fscanf" and "fread",
i used VISA-Read subVI for "fread" function but don't know which for the "fscanf"
and i don't know how the read the datamatrix with a subVI.
Is there someone can give me a tip, that will be very kind, thank you.
yours
Adam
Solved! Go to Solution.
09-25-2013 09:42 AM
09-25-2013 10:05 AM
thank you for you answers,
here is the example:
s1=serial('COM1');
...
A=fscanf(s1,'%s');
A=fread(s1,2);
B=fread(s1,[2 messurePoint]);
so i m reading from the serial port
09-25-2013 10:18 AM
09-26-2013 05:40 AM
i don't quit understand what are you mean, could you explain a little more?
i have seen all the serial examples, but they aren't help.
09-26-2013 08:00 AM
09-26-2013 08:47 AM
first thank you for your answer. the problem is when i want to read the datamatrix from the hardware with "fread(s1, [2 points])", i don't know how to realize it in Labview, and i can't find answers in LabviewHelp.
Yesterday i fund the subVI "VISA Bytes at Serial Port", but i can't set the byte width like in Matlab "fread(s1, 2)".
thanks again for your time.
09-26-2013 09:21 AM
10-16-2013 04:34 AM
hello, everyone,
i think i find out how to solve my problem.(Serial Device Controll)
fscanf is indeed expressed as VISA-Read in Labview, and very time you use fscanf, it means to write something in the memorizer of the device,
e.g:
fprintf=VISA-Write
fscanf=VISA-Read, but the Value which been readed is storaged in the memorizer of the device, when you make a indicator for the output of the VISA-Read, this Value will be showed and delete from the device memorizer. This is for my Device OTDR, i m not sure whether it's all right for other Device.
When you want to read the datamatrix, for example 2D, just use VISA-Read two times.
When you still have questions about this, feel free to ake, i will try to answer you.
Yours
Adam Yuan
10-16-2013 04:39 AM
here it the VI