Clear Filters
Clear Filters

Convert a .txt file into .mat fiie in MATLAB.

8 views (last 30 days)
Dear Members I am new to MATLAB.
I have one .txt file containg information in hex format as given below:
1234ABC6789D
AB456C78DEF
......
Like this almost 1000 values are there.
I want to write it in matrix format in matlab.
So can someone please explain how to convert this .txt file into .mat file

Answers (1)

Ameer Hamza
Ameer Hamza on 7 Nov 2020
Edited: Ameer Hamza on 7 Nov 2020
Try something like this
str = fileread('data.txt');
data = textscan(str, '%x')
data.txt used in my code is attached.
  21 Comments

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!