How to Import unformatted text data?

4 vues (au cours des 30 derniers jours)
Maddila
Maddila le 4 Oct 2012
Below I have attached a text file , how to read and separate the values
[
  4 commentaires
Matt Kindig
Matt Kindig le 4 Oct 2012
CAE is a well-known defense contractor. So, yeah, probably.
Maddila
Maddila le 5 Oct 2012
No ,,This is just reference text file,,i have to program it mr Jan Simon,,

Connectez-vous pour commenter.

Réponse acceptée

Matt Kindig
Matt Kindig le 4 Oct 2012
Hi Maddila,
This looks like a rather non-uniform format, so your best bet might be to read in the full file, and then separate it out using regexp. It looks like splitting by square brackets might do the trick. Something like this:
str = fileread('your/file/name'); %read in file in full
parts = regexp(str, '\[|\]', 'split'); %split by brackets
%then you can extract information from the individual split out sections.

Plus de réponses (0)

Catégories

En savoir plus sur Text Data Preparation dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by