From: Stefan Heinen on
I have a file name, which is a character array, and i want to place this name into a matrix. To do this, i've tried to convert the char array into a string. However, i have not found any command that can do this easily.

So, is there an easy command to convert a char array into a string, or to convert the elements of a char array into strings?
Or maybe another solution to import the character array into a matrix?

gr,

Stefan
From: Walter Roberson on
Stefan Heinen wrote:
> I have a file name, which is a character array, and i want to place this
> name into a matrix. To do this, i've tried to convert the char array
> into a string. However, i have not found any command that can do this
> easily.
>
> So, is there an easy command to convert a char array into a string, or
> to convert the elements of a char array into strings?

In Matlab, character arrays and character strings are exactly the same
thing.

> Or maybe another solution to import the character array into a matrix?

Based upon your description here and upon your later posting about
dlmwrite, it appears that you are trying to set an array position to be
a character string as if the string were a single unit. That is,
however, not possible in a numeric array. The closest you can get to
that is the cell arrays that someone else mentioned.
From: Stefan Heinen on
No these are 2 different problems. This one, is a problem from my buddy. He has import de directory file with dir. Something like:

sigfiles = dir([workdir '\*t?.sig']) ;

The next thing he likes is to display the name and byte in the command window. I got them both appart but cant put them to getter. This with a loop:

sigfiles(i).name and sigfiles(i).bytes

I got two lists.. but can't add them to getter to display them..
Anyone knows how?

Best regards,

Stefan
From: Walter Roberson on
Stefan Heinen wrote:
> He has import de directory file with dir. Something like:
>
> sigfiles = dir([workdir '\*t?.sig']) ;
>
> The next thing he likes is to display the name and byte in the command
> window. I got them both appart but cant put them to getter. This with a
> loop:
>
> sigfiles(i).name and sigfiles(i).bytes
>
> I got two lists.. but can't add them to getter to display them.. Anyone
> knows how?

printf('%s %d\n', sigfiles(i).name, sigfiles(i).bytes);
From: us on
"Stefan Heinen" <s.g.h.heinen(a)live.com> wrote in message <hrosvv$aqh$1(a)fred.mathworks.com>...
> I have a file name, which is a character array, and i want to place this name into a matrix. To do this, i've tried to convert the char array into a string. However, i have not found any command that can do this easily.
>
> So, is there an easy command to convert a char array into a string, or to convert the elements of a char array into strings?
> Or maybe another solution to import the character array into a matrix?
>
> gr,
>
> Stefan

one of the solutions
- requires you to download a FEX submission, which comes with many options...

http://www.mathworks.com/matlabcentral/fileexchange/23840

% now
d=dir('*.m');
cprintf([{d.name}.',num2cell([d.bytes].')]);
%{
% note: nice formatting seen only in the original view...
cdi.m 10240
cmake.m 39
do.m 1043
fconv.m 219
getall.m 679
gp.m 13950
rp.m 2956
wo.m 42
woloc.m 268
%}

us