フィルターのクリア

Please help me to position the starting and ending point of data

3 ビュー (過去 30 日間)
Rakesh Yadav Kodari
Rakesh Yadav Kodari 2019 年 2 月 4 日
編集済み: Adam Danz 2019 年 2 月 5 日
Hello all,
I have a long set of data I need to set starting and ending position of data.
Starting position is at "M"
ending is at "I"
I need to cut all the data Starting from "M" to ending "I" and place it in to new vector.
  4 件のコメント
Rakesh Yadav Kodari
Rakesh Yadav Kodari 2019 年 2 月 5 日
Hello all the data is HEXDEC
Look at the example:
Frames= M0400FEC9F93DF7EA02AFF9F308540209041B0746FA8B0351F671FAD0FC92F69706E9FCAC08EA05AB00430745F6AEFEA4F8F3F8100189F8CA087C002A064C0725FBC70382F722FAE6FDAEF8AE04D6FCA206BB0245024B0508FA5DFFBEFA84F9CB020CFBCF04FCFF9FBFF8B008FFFF70154016F0089037CFD720227FD06FF42FFE6FF16014E00AC00EE027DFEE5031AFCB0|
How can i know the position of the M and | ? and 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?
Gani
Gani 2019 年 2 月 5 日
Example:
str = 'M0400FCFFFAF2F7D1046DFB3808A2039B02830741F8DB01A2F6EDF94DFECEF73A083DFE6D0826069EFE540659F5D5FCE2FA71F7BE0346F9D608D3018D05250794FA02022FF727F9B2FF5FF924059FFD5806D1035700FB050BF8FDFE4CFB20F93B0336FC520520000E032A0250FE99010DFBFCFCB8FFADFC0E0365FEE20124FFB10151FF2A006D002EFFFE019401F7FF9D02DEFDCF0112FE92FFD2FFF7FFC1013200AF013802C9FEAC02FFFCBB0011FECEFEDA01080003015501DBFFE30330FD56|';
posofM = strfind(str, 'M');
posofLast = strfind(str, '|');

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

採用された回答

Gani
Gani 2019 年 2 月 5 日
Example:
str = 'M0400FCFFFAF2F7D1046DFB3808A2039B02830741F8DB01A2F6EDF94DFECEF73A083DFE6D0826069EFE540659F5D5FCE2FA71F7BE0346F9D608D3018D05250794FA02022FF727F9B2FF5FF924059FFD5806D1035700FB050BF8FDFE4CFB20F93B0336FC520520000E032A0250FE99010DFBFCFCB8FFADFC0E0365FEE20124FFB10151FF2A006D002EFFFE019401F7FF9D02DEFDCF0112FE92FFD2FFF7FFC1013200AF013802C9FEAC02FFFCBB0011FECEFEDA01080003015501DBFFE30330FD56|';
posofM = strfind(str, 'M');
posofLast = strfind(str, '|');

その他の回答 (1 件)

KSSV
KSSV 2019 年 2 月 5 日
編集済み: KSSV 2019 年 2 月 5 日
Frames= 'M0400FEC9F93DF7EA02AFF9F308540209041B0746FA8B0351F671FAD0FC92F69706E9FCAC08EA05AB00430745F6AEFEA4F8F3F8100189F8CA087C002A064C0725FBC70382F722FAE6FDAEF8AE04D6FCA206BB0245024B0508FA5DFFBEFA84F9CB020CFBCF04FCFF9FBFF8B008FFFF70154016F0089037CFD720227FD06FF42FFE6FF16014E00AC00EE027DFEE5031AFCB0|' ;
p0 = strfind(Frames,'M') ;
p1 = strfind(Frames,'|') ;
S = Frames(p0:p1) ;
iwant = reshape(S(1:100),4,[])' ;
To reshape,,you need to have comaptibility with elements. Read about reshape
  6 件のコメント
Rakesh Yadav Kodari
Rakesh Yadav Kodari 2019 年 2 月 5 日
This is the ans for the above code :
val =
'1357'
'2468'
I want 12
34
56
78
Adam Danz
Adam Danz 2019 年 2 月 5 日
編集済み: Adam Danz 2019 年 2 月 5 日
KSSV's solution is doing what you want it to do

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

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by