How do I import text from a text file in matlab?

1 visualizzazione (ultimi 30 giorni)
tban
tban il 20 Set 2017
Commentato: Rena Berman il 2 Apr 2019
I have a list like this in a MacBook text file.
frame
picture
wall
room
house
I want to import it in Matlab and use every word in a loop. How do I import the list so I can use it from another handle?
I know how to use it in the loop after I get lenght of matrix and make a loop from 1:end.
  2 Commenti
MATLAB Newbie
MATLAB Newbie il 20 Set 2017
Possibly textscan to place all words into a cell, but the page is down at the moment so I can't confirm if textscan is correct.

Accedi per commentare.

Risposte (1)

Walter Roberson
Walter Roberson il 20 Set 2017
S = regexp( fileread('TheFileName'), '\s+', 'split')
Now S is a cell array of the words in the file

Categorie

Scopri di più su Data Import and Export in Help Center e File Exchange

Tag

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by