# Thread: string matrix into single string

1. ## string matrix into single string

[code]Ok, so i have to convert this matrix into a single line of characters. For example: If i enter {XXXYYY}, i convert it into a matrix {XXX}{YYY}. i need to change it back so i can add another element to the end of the string XXXYYYY and convert it again into a matrix, without showing the first element of it like {XXY}{YYY}. How do i do that?

Code:
```for(i=0;i<size;i++)
{
aminoacidos[x][y]=nucleotideos[i];
y++;
if (y==3)
{
y=0;
x++;
}
}
for (i=0; i<((size)/3); i++) {
printf("%s\n",aminoacidos[i]);
}
if (nucleotideos[size-1]=='a')
{
strcat(nucleotideos, "a");
}
if (nucleotideos[size-1]=='t')
{
strcat(nucleotideos, "t");
}
if (nucleotideos[size-1]=='c')
{
strcat(nucleotideos, "c");
}
if (nucleotideos[size-1]=='g')
{
strcat(nucleotideos, "g");
}
for(i=1;i<size+1;i++)
{
aminoacidos[x][y]=nucleotideos[i];
y++;
if (y==3)
{
y=0;
x++;
}
}
for (i=1; i<((size+1)/3); i++) {
printf("%s\n",aminoacidos[i]);
}```

2. In a one dim array, matrix elements are accessed like this matrix[ x * cols + y]. If you make a copy of the matrix entering elements with this formula it will work.