In the previous video, you learned how to write data to an external file. In this video, learn how to read values from an external file into a MATLAB variable.
- [Instructor] In the previous movie,…I showed you how to write data to an external file.…In this movie,…I will show you how to read values from an external file…into a MATLAB variable.…I have just started MATLAB…and I have a clean command window ready to go.…So the first thing I need to do is create a file…with some values.…I'll start by defining a variable called mat1,…and then an equal sign for the assignment,…and I will create the first row…with the values four through 16…going up in increments of four.…
So I'll type four then a colon,…my step value is four colon,…and the top value is 16.…Then a semicolon to indicate I have a new row,…and then we'll do five through 20…going up by five for the second row.…So five colon five colon 20.…Right square bracket and Enter,…and there I get my two by four matrix.…If I want to save these values in a file,…then I'd need to use the save function.…A space, then I will call the file matrixdata.dat.…
I don't need to add the extension.…It can just be matrixdata.…But when someone looks at it in the current folder,…
Author
Released
8/28/2018- Defining variables and contains
- Exploring operators
- Summarizing with built-in functions
- Generating random numbers
- Defining vectors and matrices
- Accepting input in scripts
- Writing and reading data from external files
- Creating custom functions
- Using conditional logic
- Repeating operations with loops
- Working with text strings
- Plotting data and function output
- Formatting, saving, and printing plots
- Using statistical and matrix functions
Skill Level Intermediate
Duration
Views
Related Courses
-
SAS Programming for R Users, Part 2
with Jordan Bakerman2h 2m Intermediate
-
Introduction
-
What you should know1m 6s
-
1. Starting Out with MATLAB 2018
-
Define ranges of values4m 45s
-
Generate random numbers5m 35s
-
Get help in MATLAB4m 11s
-
2. Managing Vectors and Matrices
-
Define vectors and matrices5m 56s
-
-
3. Creating MATLAB Scripts
-
Create a MATLAB script7m 33s
-
-
4. Conditional Logic and Loops
-
Use is statements3m 45s
-
5. Managing Strings and Data Structures
-
Define string variables2m 9s
-
Concatenate strings3m 12s
-
Convert strings to numbers4m 22s
-
-
6. Performing Advanced Plotting and Statistical Analysis
-
Create other plot types10m 11s
-
Format plot elements4m 56s
-
Save and print plots3m 18s
-
Conclusion
-
Further information1m 6s
-
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.
CancelTake notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.
Share this video
Embed this video
Video: Load values from a file into a script