MATLAB Answers

How to concatenate horizontaly and not vertically

1 view (last 30 days)
Merlin Piron
Merlin Piron on 16 Apr 2020
Commented: Stephan on 16 Apr 2020
Hello everybody,
I'm sorry for my stupid question but I'm starting on matlab ..
I have a problem in my code ... my C and V vectors concatenate vertically ... how can I modify that?
clear all
clc
experience = 'Assets';
extension ='csv';
filelist = dir([experience,'/*',extension]);
nfiles = length(filelist);
% Pour chaque fichier, on récupère les infos et les données
% les données sont stockées dans des tableaux RAIES et DATAS
C = [];
V = [];
for ifile = 1:nfiles
disp(['Traitement du fichier n° ',sprintf('%d',ifile)])
probname = filelist(ifile).name;
probdate = filelist(ifile).date;
tmp=readmatrix([experience,'/',probname]);
RAIES = tmp(:,6);
DATAS = tmp(:,7);
C = [C; [RAIES]];
V = [V; [DATAS]];
end

  0 Comments

Sign in to comment.

Accepted Answer

Stephan
Stephan on 16 Apr 2020
use
C = [C, RAIES];
V = [V, DATAS];
instead
C = [C; RAIES];
V = [V; DATAS];

  2 Comments

Stephan
Stephan on 16 Apr 2020
my pleasure - you might want to accept useful answers in order to show others the questions answer worked for you.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!