This is a static archive of our old Q&A Site. Please post any new questions and answers at ask.wireshark.org.

[closed] Using Matlab script pcap2matlab.m to plot particular Modbus Register vs Time

0

I am using the Matlab script pcap2matlab.m to create a time plot of a Modbus register. (The Matlab script calls TShark).

In Wireshark I can see the parameter I want: alt text

To plot this Modbus register as a function of time I am using pcap2matlab.m. I created a simple script to call pcap2matlab.m for this purpose. This script is listed below:


%pcap2matlab_example2() isRead = true;

CAPTURE_FILE = 'REL2_test02_onOffHVPW.pcapng'; %% Set up the capturing/reading parameters: dissector = {'modbus.func_code',... 'modbus.request_frame',... 'modbus.byte_cnt',... 'modbus.reg32'};

capture_filter = 'tcp and src port 502';
read_filter = 'modbus'; %% Capture/read:
if isRead % Read: pcap_result = pcap2matlab(read_filter, dissector, CAPTURE_FILE); else % Capture: pcap_result = pcap2matlab(capture_filter,dissector, 4, 700); end


And it works, I get a result for each packet in a Matlab structure array! However, it gives me all the Modbus registers for a given packet combined as a single large decimal, like 5.1205e+247. How can I extract the Modbus register I want from this large decimal (i.e. Register 5523 = 1234.900635 in the image above)?

asked 24 Feb '17, 12:54

bmain57's gravatar image

bmain57
0226
accept rate: 0%

closed 27 Feb '17, 07:45

cmaynard's gravatar image

cmaynard ♦♦
9.4k1038142

(27 Feb '17, 07:45) cmaynard ♦♦

The question has been closed for the following reason “Duplicate Question” by cmaynard 27 Feb ‘17, 07:45