Info
This question is closed. Reopen it to edit or answer.
Importing txt file using the importdata comand
1 view (last 30 days)
Show older comments
Hello,
*1: *
I wrote a function that does some manipulations over a vector strings. Now, I want to apply it on text files.
So let's assume XXX.txt is :
hello world
hello world world
hello world world world
So I wrote:
A = importdata comand ('XXX.txt')
when I run A I get :
A =
'hello world'
'hello world world'
'hello world world'
Now, I want it to be treated as 3 separated vectors of chars. How can I do it? or better question is how to get to one of the vectors? For example: V1 = 'hello world' and V1(1,1)=h
2:
When I tryed to run text files with a lot of text I received this message:
A = importdata('a_lot_of_text.txt')
A =
[1x2568 char]
what does it means? and the first question refers to this also.
Thank's!
2 Comments
Friedrich
on 17 Apr 2013
Edited: Friedrich
on 17 Apr 2013
When I import the xxx.txt i get what you want right away:
>> A = importdata('XXX.txt')
A =
'hello world'
'hello world world'
'hello world world world'
>> A{1}
ans =
hello world
>> A{1}(1,1)
ans =
h
>> A{1}(1,1:3)
ans =
hel
It seems like that a_lot_of_text.txt has a different format than xxx.txt
Answers (0)
This question is closed.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!