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

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.3k1038142

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

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×32
×3
×1
×1

question asked: 24 Feb '17, 12:54

question was seen: 1,253 times

last updated: 27 Feb '17, 07:45

p​o​w​e​r​e​d by O​S​Q​A