Import txt. files from a folder for training data
2 次查看(过去 30 天)
显示 更早的评论
How do Import *txt files from a folder into a cell array with nummeric array, or something else that is a suitable for training with a neural network.
I tried to import them via a FileDatastore:
x_train = fileDatastore("train\a_train\", "ReadFcn", @load);
y_train = fileDatastore("train\a_classification\", "ReadFcn", @load);
a = combine(x_train, y_train)
But this didn't seems to be the right format for training data. Sorry if this is a dump question, but its quite hard to figure out how to set up right training data.
The txt.files are all same as shown in this example. The Y_training data are just the same amount of txtfiles with just a 1,2 or 3 in it, for the 3 vowels I want to differentiate. Maybe there is also a smarter soultion for this.
It would be really helpfull, im a little bit lost so everything helps.
thx
0 个评论
采纳的回答
Arif Hoq
2022-3-18
if you want to import all the text files,try this
textfiles = dir('*.txt');
numfiles = length(textfiles);
mydata = cell(1, numfiles);
for k = 1:numfiles
mydata{k} = load(textfiles(k).name);
% mydata{k} = open(textfiles(k).name);
end
this syntax, mydata{k} = open(textfiles(k).name) above will open all the text file in a matlab script.
Or, if you want to import a specific text file,then
A=readtable('a_fft - Kopie (1).txt','ReadVariableName',false); % if your text file contains numeric and string
A=readmatrix('a_fft - Kopie (1).txt'); % if your text file contains only numeric
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Deep Learning Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!