How to load a text file?
up vote
-1
down vote
favorite
I want to load a file collection1.txt
. So I wrote:
function [output] = calculate_tfidf('E:backupMediacollection1.txt')
end
But when I run the program to see if file has been loaded I get the message below:
Error: File:
calculate_tfidf.m
Line: 2 Column: 36
Invalid expression. Check for missing multiplication operator, missing or unbalanced delimiters, or other syntax error. To construct matrices, use brackets instead of parentheses.
What did I do wrong?
matlab text-files
add a comment |
up vote
-1
down vote
favorite
I want to load a file collection1.txt
. So I wrote:
function [output] = calculate_tfidf('E:backupMediacollection1.txt')
end
But when I run the program to see if file has been loaded I get the message below:
Error: File:
calculate_tfidf.m
Line: 2 Column: 36
Invalid expression. Check for missing multiplication operator, missing or unbalanced delimiters, or other syntax error. To construct matrices, use brackets instead of parentheses.
What did I do wrong?
matlab text-files
1
Please take a basic tutorial or read the documentation to learn how to define functions. You cannot just type random text and expect it to work. Did you type your exact question title in Google? Because that gives many working solutions.
– Sardar Usama
Nov 10 at 23:29
Have you looked atdlmread
?
– SecretAgentMan
Nov 11 at 5:05
add a comment |
up vote
-1
down vote
favorite
up vote
-1
down vote
favorite
I want to load a file collection1.txt
. So I wrote:
function [output] = calculate_tfidf('E:backupMediacollection1.txt')
end
But when I run the program to see if file has been loaded I get the message below:
Error: File:
calculate_tfidf.m
Line: 2 Column: 36
Invalid expression. Check for missing multiplication operator, missing or unbalanced delimiters, or other syntax error. To construct matrices, use brackets instead of parentheses.
What did I do wrong?
matlab text-files
I want to load a file collection1.txt
. So I wrote:
function [output] = calculate_tfidf('E:backupMediacollection1.txt')
end
But when I run the program to see if file has been loaded I get the message below:
Error: File:
calculate_tfidf.m
Line: 2 Column: 36
Invalid expression. Check for missing multiplication operator, missing or unbalanced delimiters, or other syntax error. To construct matrices, use brackets instead of parentheses.
What did I do wrong?
matlab text-files
matlab text-files
edited Nov 12 at 10:18
SecretAgentMan
397110
397110
asked Nov 10 at 23:20
user3052811
122
122
1
Please take a basic tutorial or read the documentation to learn how to define functions. You cannot just type random text and expect it to work. Did you type your exact question title in Google? Because that gives many working solutions.
– Sardar Usama
Nov 10 at 23:29
Have you looked atdlmread
?
– SecretAgentMan
Nov 11 at 5:05
add a comment |
1
Please take a basic tutorial or read the documentation to learn how to define functions. You cannot just type random text and expect it to work. Did you type your exact question title in Google? Because that gives many working solutions.
– Sardar Usama
Nov 10 at 23:29
Have you looked atdlmread
?
– SecretAgentMan
Nov 11 at 5:05
1
1
Please take a basic tutorial or read the documentation to learn how to define functions. You cannot just type random text and expect it to work. Did you type your exact question title in Google? Because that gives many working solutions.
– Sardar Usama
Nov 10 at 23:29
Please take a basic tutorial or read the documentation to learn how to define functions. You cannot just type random text and expect it to work. Did you type your exact question title in Google? Because that gives many working solutions.
– Sardar Usama
Nov 10 at 23:29
Have you looked at
dlmread
?– SecretAgentMan
Nov 11 at 5:05
Have you looked at
dlmread
?– SecretAgentMan
Nov 11 at 5:05
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
So you were defining a function, but you need to call that function,
In a modern version of Matlab you could code this something more like this:
Tfidf=calculate_tfidf('E:backupMediacollection1.txt')
Now below that in the same file, define the actual function
function output= calculate_tfidf(filename)
% now put your function cde in here
% Eg...
data = extractFileText(filename);
text = split(data,newline);
output = tokenizedDocument(text);
end
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
So you were defining a function, but you need to call that function,
In a modern version of Matlab you could code this something more like this:
Tfidf=calculate_tfidf('E:backupMediacollection1.txt')
Now below that in the same file, define the actual function
function output= calculate_tfidf(filename)
% now put your function cde in here
% Eg...
data = extractFileText(filename);
text = split(data,newline);
output = tokenizedDocument(text);
end
add a comment |
up vote
0
down vote
So you were defining a function, but you need to call that function,
In a modern version of Matlab you could code this something more like this:
Tfidf=calculate_tfidf('E:backupMediacollection1.txt')
Now below that in the same file, define the actual function
function output= calculate_tfidf(filename)
% now put your function cde in here
% Eg...
data = extractFileText(filename);
text = split(data,newline);
output = tokenizedDocument(text);
end
add a comment |
up vote
0
down vote
up vote
0
down vote
So you were defining a function, but you need to call that function,
In a modern version of Matlab you could code this something more like this:
Tfidf=calculate_tfidf('E:backupMediacollection1.txt')
Now below that in the same file, define the actual function
function output= calculate_tfidf(filename)
% now put your function cde in here
% Eg...
data = extractFileText(filename);
text = split(data,newline);
output = tokenizedDocument(text);
end
So you were defining a function, but you need to call that function,
In a modern version of Matlab you could code this something more like this:
Tfidf=calculate_tfidf('E:backupMediacollection1.txt')
Now below that in the same file, define the actual function
function output= calculate_tfidf(filename)
% now put your function cde in here
% Eg...
data = extractFileText(filename);
text = split(data,newline);
output = tokenizedDocument(text);
end
answered Nov 11 at 9:05
RichardBJ
1415
1415
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53244380%2fhow-to-load-a-text-file%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Please take a basic tutorial or read the documentation to learn how to define functions. You cannot just type random text and expect it to work. Did you type your exact question title in Google? Because that gives many working solutions.
– Sardar Usama
Nov 10 at 23:29
Have you looked at
dlmread
?– SecretAgentMan
Nov 11 at 5:05