Undefined function 'loadfile' for input arguments of type 'char'.

1 回表示 (過去 30 日間)
Benjamin
Benjamin 2012 年 11 月 3 日
I am suppose to run this function called Batch. Based on my understanding, I am suppose to import a file in .txt format. I have prepared/preprocess the necessary .txt file and configured the t_train_path to point to the directory where the file is located. But still I get this error.
below is the line of code from batch.m that is giving me the error.
% ----------------------------------------------------------------
% Load train file
% ----------------------------------------------------------------------
% specify your training file here %
% e.g. t_file = '\Dataset\My_folder\My_train_file.txt'
% or use sprintf as below
% t_file = sprintf('\\DataSet\\D%d_%s_40_%dc(s).txt',1,'05',1);
t_file = '/Users/yongbenjamin/Desktop/Spiral/SpiralTrain_T.txt'
t_train_path = [pwd t_file];
train_set = loadfile(t_train_path);
% ---------------------------------------------------------------
------- //Code
>> cd /Users/yongbenjamin/Desktop/Spiral/
>> ls
SpiralTest.txt SpiralTrain.mat Spiral_T.txt
SpiralTrain.csv SpiralTrain_T.txt matlab.mat
>> Batch
t_file =
/Users/yongbenjamin/Desktop/Spiral/SpiralTrain_T.txt
Undefined function 'loadfile' for input arguments of type 'char'. Error in Batch (line 14) train_set = loadfile(t_train_path); //End of Code

回答 (3 件)

Walter Roberson
Walter Roberson 2012 年 11 月 3 日
loadfile() is not a Mathworks-supplied routine.
Where you thinking of load() ?

Benjamin
Benjamin 2012 年 11 月 3 日
Hi walter,
Do you meant where did I get this loadfile() function from? This whole program is designed from internal use. And I am trying to figure out how to use it. Apparently the documentation on the various function was not done detailed. I just to load a .txt file into the system. I just tried, and apparent now it solve the problem from that line of code.
  1 件のコメント
Walter Roberson
Walter Roberson 2012 年 11 月 3 日
All we can do is make the generalization that loadfile.m must be on your MATLAB path; you can use pathtool to adjust your path. loadfile() is not supplied with MATLAB, so either it is supplied with your internal code or else the internal code is incorrect.

サインインしてコメントする。


Benjamin
Benjamin 2012 年 11 月 3 日
Walter,
i just checked through internal code file directory. It contain loadfile.dll instead of the loadfile.m. May I confirm with you if there is a possibility that the loadfile function is located within loadfile.dll instead. Apparent the train_set data doesnt seem right as well to me.. I am having problem with the other line of codes, probably due to this fault
  3 件のコメント
Benjamin
Benjamin 2012 年 11 月 4 日
Hi walter, you are right. Any solution to work around this?
Walter Roberson
Walter Roberson 2012 年 11 月 4 日
You can run the 32 bit version of MATLAB on a 64 bit Windows operating system, or you can rebuild the dll for 64 bit use.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeSearch Path についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by