Please help me in positioning start and end of the data(Example is given below)

1 回表示 (過去 30 日間)
M0400FCFFFAF2F7D1046DFB3808A2039B02830741F8DB01A2F6EDF94DFECEF73A083DFE6D0826069EFE540659F5D5FCE2FA71F7BE0346F9D608D3018D05250794FA02022FF727F9B2FF5FF924059FFD5806D1035700FB050BF8FDFE4CFB20F93B0336FC520520000E032A0250FE99010DFBFCFCB8FFADFC0E0365FEE20124FFB10151FF2A006D002EFFFE019401F7FF9D02DEFDCF0112FE92FFD2FFF7FFC1013200AF013802C9FEAC02FFFCBB0011FECEFEDA01080003015501DBFFE30330FD56|
The given data is in Hexadecimal form
  1. How can I find the position of "M" and Position of "|" ?
I did write somecode but its not working:
positionOfM = index(frames, "M");
if (positionOfM <= 0)
return;
end
% find the end of the M frame, the '|' marker
positionOfEnd = i(frames, "|");
if (positionOfEnd <= 0)
return;
end

採用された回答

Gani
Gani 2019 年 2 月 5 日
Use strfind to get the index.
Example:
str = 'M0400FCFFFAF2F7D1046DFB3808A2039B02830741F8DB01A2F6EDF94DFECEF73A083DFE6D0826069EFE540659F5D5FCE2FA71F7BE0346F9D608D3018D05250794FA02022FF727F9B2FF5FF924059FFD5806D1035700FB050BF8FDFE4CFB20F93B0336FC520520000E032A0250FE99010DFBFCFCB8FFADFC0E0365FEE20124FFB10151FF2A006D002EFFFE019401F7FF9D02DEFDCF0112FE92FFD2FFF7FFC1013200AF013802C9FEAC02FFFCBB0011FECEFEDA01080003015501DBFFE30330FD56|';
posofM = strfind(str, 'M');
posofLast = strfind(str, '|');
  2 件のコメント
Rakesh Yadav Kodari
Rakesh Yadav Kodari 2019 年 2 月 5 日
Thank you
Rakesh Yadav Kodari
Rakesh Yadav Kodari 2019 年 2 月 5 日
I need to divide every 4 datas in the whole frame.
for example size = Frames(1:4);
Length = Frames(5:8); ........so on but its too long any other option?

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAssembly についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by