|
From: | ionavideo |
Subject: | Thanks Re: Loading hex data |
Date: | Mon, 17 Sep 2012 07:41:19 -0700 (PDT) |
Thanks. I really appreciate the suggestions. I tried both dlmread and textread. With textread I get an "error" I can sort of work with. Here is the data file keydata.txt: 32 51 0b a9 ba So we have 5 hexadecimal numbers separated by CR-LF And here is the Octave line: k= hex2dec(textread("keydata.txt", "%d")) And the output from running the test program is: k = 0 3 0 0 0 Which is not a correct translation of "32 51 0b a9 ba" because 32 hex equals 50 dec or the ascii "2" and 51 hex equals dec 81 or ascii "Q", etc. Yes, I tried other ways to format the line, as follows: #k= hex2dec(textread("keydata.txt", "%x")) # the above gives "error: Invalid call to hex2dec. Correct usage is hex2dec(S) #k= hex2dec(textread("keydata.txt", "%s")) #the above gives several errors, including: 'string undefined ... called from # ... toascii.m # error evaluating argument list element number 1 # error ... strjust.m # error ... base2dec.m # errpr ... hex2dec.m --------------------------------------------------------- So my question is, should I be using %s or %d to format a hex2dec function call of a textread of a hex file AND if I should be using %s, what do I need to do to make the line work? thanks. --- On Thu, 9/13/12, Jordi GutiƩrrez Hermoso-2 [via Octave] <[hidden email]> wrote:
|
[Prev in Thread] | Current Thread | [Next in Thread] |