Borrar filtros
Borrar filtros

change variable and assign to dataset in each loop

1 visualización (últimos 30 días)
Reyasudin
Reyasudin el 24 de Jun. de 2013
Hello,
I have one excel file that contains 12 sheets. Each sheets contains 5 columns I want to read each sheet and put in one dataset. So, I am thinking is it possible for me to create for loop in order to have 12 datasets.
as an example:
for sheet=1:12;
%import excel file (sheet)
% A(sheet)= dataset(column1, column2, column3, column4, column 5)
end

Respuesta aceptada

Iain
Iain el 24 de Jun. de 2013
Three approaches
for i = 1:12 %(Sheets not the same size)
[numbers{i} texts{i} raws{i}] = xlsread(....);
end
Or
for i = 1:12 %(All sheets same size)
numbers(:,:,i) = xlsread(...)
end
Or
numbers = [];
for i = 1:12 %(All sheets same size)
n = xlsread(...);
numbers = [numbers; n];
end

Más respuestas (0)

Categorías

Más información sobre Data Import from MATLAB en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by