How to write a program that selectively picks hexadecimal values from a text file based on bit size?
Mostrar comentarios más antiguos
Hello all! I have a text file that is full of 16bit, 32bit, 64bit, and 128bit hexadecimal values, and I was trying to write a program that asks user the bit-size, then once the size is selected, a random hexadecimal value from the text file is spit out. I was thinking about if statements, but nothing I try is working. Any help or guidance would be greatly appreciated!
Edit Sorry! I have added the text file, but it is 4 hex values per a line, then enter. There are a lot more values than this in the real one but it follows same format
Edit#2
I am mostly confused with syntax for the bit selector, but I was thinking something like:
read file,
user selects bit mode (4 options)
if 16bit --> rand
if 32bit --> rand
if 64bit -->rand
if 128bit -->rand
if anything else, error
7 comentarios
Scott MacKenzie
el 15 de Jun. de 2021
Editada: Scott MacKenzie
el 15 de Jun. de 2021
It might help if you attach an example file.
Akana Juliet
el 15 de Jun. de 2021
Stephen23
el 15 de Jun. de 2021
How are the values delimited? What structure does the file have, or is it just one line of values?
Please upload a sample file by clicking on the paperclip button.
Akana Juliet
el 15 de Jun. de 2021
Scott MacKenzie
el 15 de Jun. de 2021
So, can we assume the "real" text file simply repeats the organization in the example file? That is, lines 1, 5, 9, etc., contain 16-bit hex values, lines 2, 6, 10, etc., contain 32-bit hex values, and so on? And can we assume the user input is one of 16, 32, 64, or 128?
Akana Juliet
el 15 de Jun. de 2021
Scott MacKenzie
el 15 de Jun. de 2021
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Data Type Conversion en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!