Inputing textfile data as meaningful variables
Mostrar comentarios más antiguos
Hi!
I'm having a bit of trouble inputing a collection of large data as a textfile and turning that data into meaningful variables.
My code currently only returns the first value of that column of values that I am interested in, hoping for it to instead create a cell array of all values in that first column.
Probably an easy solution, still figuring out MATLAB, any help would be appreciated. Thank you:)
% Load Data
file = fopen('data.test.txt','r');
str = textscan(file,'%f%s%f%s%f%s%s%s%s%s%f%f%f%s');
fclose(file)
% Data Variables
Age = str{1};
1 comentario
Image Analyst
el 26 de Abr. de 2020
You forgot to attach 'data.test.txt'. In the meantime, try importdata() or readmatrix().
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Text Files en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!