Can I Split the char with out deliminater ? (Please have a look at example)
    11 views (last 30 days)
  
       Show older comments
    
    Rakesh Yadav Kodari
 on 5 Feb 2019
  
    
    
    
    
    Commented: Rakesh Yadav Kodari
 on 5 Feb 2019
            For example if I have char Data = FD86FA78F79B0425FAEE0866031E02F60742F9840240F6C0F999FE4BF6F407FDFE2208330680FEB20680F6;
and i have no deliminater to split it, but ineed to split it in to 4 chars each
Expected ans = FD86
                         FA78
                         F79B
                         0425 and so on till end
and convert them in to Decimal(they are in Hex form)
0 Comments
Accepted Answer
  Stephen23
      
      
 on 5 Feb 2019
        
      Edited: Stephen23
      
      
 on 5 Feb 2019
  
      >> str = 'FD86FA78F79B0425FAEE0866031E02F60742F9840240F6C0F999FE4BF6F407FDFE2208330680FEB20680F6';
>> sscanf(str,'%4x')
ans =
   64902
   64120
   63387
    1061
   64238
    2150
     798
     758
    1858
   63876
     576
   63168
   63897
   65099
   63220
    2045
   65058
    2099
    1664
   65202
    1664
     246
Note that your example character vector's length is not a multiple of four: you should check this before converting, otherwise you might get unexpected values. You need to decide if non-multiple-of-four lengths require special handling.
0 Comments
More Answers (1)
  YT
      
 on 5 Feb 2019
        I don't want to critize too much, but it just seems you're asking so many question on the same dataset that its almost like the volunteers on this forum are doing all your work for you. Therefore I wont give you the code, but here's a question which is similar when it comes to splitting strings. And I suggest you look in the documentation for converting decimal to hexadecimal.
See Also
Categories
				Find more on Data Type Conversion in Help Center and File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

