Dear Friends,
How to import and export a variable and Arrays from Math script Node to Mathscript window ...
Is there anyway to do like this..(available in matlab)
one more doubt.....
I am reading a data from serial port one byte at time.....
I need to save data into an array and check the array data with predefined format(we decided format and sending the format on the serial port)......
my doubt is whether the array get's initalized every time..when i enter the mathscript window again and again since mathscript node is inside the while loop.....
I am unable to compare the array data with the formats.....so i feel that whether the array contains the value or not...
how to confirm that array is having the received data...which i saved
or else how to save 4byte of data of string types(fetched once...4 bytes at once ..by giving in
bytes to read option in serial port vi) ............... given as input to the math script node to an array which can save 4 bytes of data .............................
below is the code
persistent bHeader
persistent ubIndex
ubTemp=input
if bHeader ==0
if ubTemp == 89
ubIndex= 0
bHeader = 1
end
else
ubIndex= ubIndex +1
ubReceivedata(ubIndex) = ubTemp
if ubIndex == 3
ubIndex = 0
bHeader = 0
end
end
ubChecksum = ubRecieveData(1) + ubRecieveData(2) + ubRecieveData(3)
if ubChecksum == 0
if ubRecieveData(1) == 76
duLen1 = ubRecieveData(2)
elseif ubRecieveData(1) == 69
duLen2 = ubRecieveData(2)
elseif ubRecieveData(1) == 78
duLen3 = ubRecieveData(2)
elseif ubRecieveData(1) == 71
duLen4 = ubRecieveData(2)
duLength = duLen1 * 16777216 + duLen2 * 65536 + uwLen3 * 256 + ubLen4
elseif ubRecieveData(1) == 80
uwTemp1 = ubRecieveData(2);
elseif ubRecieveData(1) == 66
ubTemp2 = ubRecieveData(2);
uwpackageSpeed = uwTemp1 * 256 + ubTemp2;
elseif ubRecieveData(1) == 68
uwTemp1 = ubRecieveData(2);
else ubRecieveData(1) == 65
ubTemp2 = ubRecieveData(2);
uwDrumSpeed = uwTemp1 * 256 + ubTemp2;
end
end
kindly send ur suggestions
regards
rajasekar