Print column vectors with different sizes

4 vues (au cours des 30 derniers jours)
Bernd
Bernd le 28 Fév 2012
Hello,
I've got the following problem, but wasn't able got find a solution so far:
A program analyses some data and prints out the results as csv-files which contain one column vector with arbitrary size. I want to write a script which reads some of the csv-files and prints the vectors into one new csv-file, while the heading contains the filename
#Input from first file:
a = [1;2;3];
filename = "aaa";
A = [A, a];
file = strcat(file, ",", filename);
#Input from second file:
a = [1;2;3;4;5];
filename = "bbb";
A = [A, a]; # Here the error occurs
file = strcat(file, ",", filename);
When I do it like this I get the error that the size of the matrix doesn't match. Resizing the matrix and padding it with 0 isn't an option as it would give wring results in the later run. I found the "append" option for csvwrite, but it only works with appending lines, not with appending columns.
Has anybody an idea how to print columns with different lengths into an csv-file?
Regards
Bernd

Réponses (1)

Walter Roberson
Walter Roberson le 28 Fév 2012
csvwrite() and dlmwrite() are not appropriate commands for your purpose.

Catégories

En savoir plus sur Tables 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