How to label of CSV files

9 visualizaciones (últimos 30 días)
Kong
Kong el 8 de Abr. de 2020
Editada: Kong el 8 de Abr. de 2020
Hello.
I am using CSV files.
In this code, I read CSV files and adjust the row and column.
I want to label the data.
(bend - 0, jack - 1, jump - 2, pjump - 3, run - 4, side - 5, skip - 6, walk - 7, wave1 - 8 , wave2 - 9)
I'm just using this code to label, but I have to change the value because of different files.
A = [ones(1,17) 17*ones(1,17) 3*ones(1,17) 4*ones(1,17) 5*ones(1,17) 6*ones(1,17) 7*ones(1,17) 8*ones(1,17) 9*ones(1,17) 10*ones(1,17) ones(1,17) 17*ones(1,17) 3*ones(1,17) 4*ones(1,17) 5*ones(1,17) 6*ones(1,17) 7*ones(1,17) 8*ones(1,17) 9*ones(1,17) 10*ones(1,17) ones(1,17) 17*ones(1,17) 3*ones(1,17) 4*ones(1,17) 5*ones(1,17) 6*ones(1,17) 7*ones(1,17) 8*ones(1,17) 9*ones(1,17) 10*ones(1,17) ones(1,17) 17*ones(1,17) 3*ones(1,17) 4*ones(1,17) 5*ones(1,17) 6*ones(1,17) 7*ones(1,17) 8*ones(1,17) 9*ones(1,17) 10*ones(1,17) ones(1,17) 17*ones(1,17) 3*ones(1,17) 4*ones(1,17) 5*ones(1,17) 6*ones(1,17) 7*ones(1,17) 8*ones(1,17) 9*ones(1,17) 10*ones(1,17) ones(1,17) 17*ones(1,17) 3*ones(1,17) 4*ones(1,17) 5*ones(1,17) 6*ones(1,17) 7*ones(1,17) 8*ones(1,17) 9*ones(1,17) 10*ones(1,17) ones(1,17) 17*ones(1,17) 3*ones(1,17) 4*ones(1,17) 5*ones(1,17) 6*ones(1,17) 7*ones(1,17) 8*ones(1,17) 9*ones(1,17) 10*ones(1,17) ones(1,17) 17*ones(1,17) 3*ones(1,17) 4*ones(1,17) 5*ones(1,17) 6*ones(1,17) 7*ones(1,17) 8*ones(1,17) 9*ones(1,17) 10*ones(1,17) ones(1,17) 17*ones(1,17) 3*ones(1,17) 4*ones(1,17) 5*ones(1,17) 6*ones(1,17) 7*ones(1,17) 8*ones(1,17) 9*ones(1,17) 10*ones(1,17)]';
Can I get some ideas to fix this code?
clear all
close all
% Create the list of csv files
s = dir('*.csv');
% Read from each csv file
c = cell(numel(s),1 );
for kk = 1:numel(s )
filePath = fullfile(s(kk).folder,s(kk).name );
x = csvread(filePath );
c{kk} = x;
end
% Find the minumul number of row and column
row = cellfun(@(x) size(x,1),c );
col = cellfun(@(x) size(x,2),c );
minRow = min(row );
minCol = min(col);
% Adjust the size of each array to minRow-by-minCol
c = cellfun(@(x) x(1:minRow,1:minCol),c,'UniformOutput',false);
Data = cell2mat(c);

Respuestas (0)

Categorías

Más información sobre Matrices and Arrays en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by