use of horzcat

2 vues (au cours des 30 derniers jours)
Richard
Richard le 19 Juin 2012
What is the use of horzcat? Is there an advantage of using horzcat over manually concatenating arrays horizontally? for example:
A = {'a','b','c'};
B = {'d','e'};
C = horzcat(A,B);
This is the same as:
A = {'a','b','c'};
B = {'d','e'};
C = [A,B];
So, is there an advatage of using horzcat?

Réponse acceptée

Jan
Jan le 20 Juin 2012
When you type [A, B] in the code, horzcat is called internally, as it is when it is called explicitely also. [.,.] is a synonym only.
cat(2, A, B) replies the same result, but as far as I remember it has a tiny difference in the runtime.
  1 commentaire
rudolf
rudolf le 10 Juil 2012
Hello Jan
If i have several txt files on a folder instead of specify A, B, C,... how can i read all files inside a folder Im trying to use:
C=cat(1, F{:}) but is not working
Thanks rf

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Creating and Concatenating Matrices dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by