How to reduce the code (csvread, reshape, concatenate matrix)?
이전 댓글 표시
Hello.
I wanna reduce the below code to use several other folders. in particular, how to read files without each reading.
1. read file in the folder
2. reshape several rows to one row
3. extracting data for the same length
4. concatenate matrix
5.Add a label at the end
clear all
close all
% read file in fold
A = csvread('bend/daria_bend_geo01.csv');
B = csvread('bend/denis_bend_geo01.csv');
C = csvread('bend/eli_bend_geo01.csv');
D = csvread('bend/ido_bend_geo01.csv');
E = csvread('bend/ira_bend_geo01.csv');
F = csvread('bend/lena_bend_geo01.csv');
G = csvread('bend/lyova_bend_geo01.csv');
H = csvread('bend/moshe_bend_geo01.csv');
I = csvread('bend/shahar_bend_geo01.csv');
% reshape several rows to one row
A=reshape(A,[],1);
B=reshape(B,[],1);
C=reshape(C,[],1);
D=reshape(D,[],1);
E=reshape(E,[],1);
F=reshape(F,[],1);
G=reshape(G,[],1);
H=reshape(H,[],1);
I=reshape(I,[],1);
% extracting data for same length
A=A(1:1568,:);
B=B(1:1568,:);
C=C(1:1568,:);
D=D(1:1568,:);
E=E(1:1568,:);
F=F(1:1568,:);
G=G(1:1568,:);
H=H(1:1568,:);
I=I(1:1568,:);
% concatenate matrix
bend = [A.';B.';C.';D.';E.';F.';G.';H.';I.']
% Add a label at the end
0 or 1
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!