From: Guido on
I have the following string and I want to save with xlswrite the following displayed
text and numeric data output:

C={'Art','Science','Cinema'};
for i=1:3
disp([C(1:i),num2str(1:i)])
end

I proceed as follows

for i=1:3
dd(i,:)={[C(1:i),num2str(1:i)]};
end
s=xlswrite('your.xls',dd)

and I obtain s=1. However the saved file 'your.xls' is empty.
I understand that xlswrite accepts only explicitly written cells
as in Example 2 of the help window, but I don't know how to
deal with this case where there is a string (C). Please help, jay.
From: kinor on
"Guido" <jay_of_may(a)yahoo.com> wrote in message <hpukd3$1a1$1(a)fred.mathworks.com>...
> I have the following string and I want to save with xlswrite the following displayed
> text and numeric data output:
>
> C={'Art','Science','Cinema'};
> for i=1:3
> disp([C(1:i),num2str(1:i)])
> end
>
> I proceed as follows
>
> for i=1:3
> dd(i,:)={[C(1:i),num2str(1:i)]};
> end
> s=xlswrite('your.xls',dd)
>
> and I obtain s=1. However the saved file 'your.xls' is empty.
> I understand that xlswrite accepts only explicitly written cells
> as in Example 2 of the help window, but I don't know how to
> deal with this case where there is a string (C). Please help, jay.

an attempt:
for i=1:3
dd{i,1}=C{i};
dd{i,2}=num2str(i);
end

s=xlswrite('your.xls',dd)

hth
kinor
From: Guido on
"kinor " <kinor.removethiswithdot(a)gmx.de> wrote in message <hpusr4$32r$1(a)fred.mathworks.com>...
> "Guido" <jay_of_may(a)yahoo.com> wrote in message <hpukd3$1a1$1(a)fred.mathworks.com>...
> > I have the following string and I want to save with xlswrite the following displayed
> > text and numeric data output:
> >
> > C={'Art','Science','Cinema'};
> > for i=1:3
> > disp([C(1:i),num2str(1:i)])
> > end
> >
> > I proceed as follows
> >
> > for i=1:3
> > dd(i,:)={[C(1:i),num2str(1:i)]};
> > end
> > s=xlswrite('your.xls',dd)
> >
> > and I obtain s=1. However the saved file 'your.xls' is empty.
> > I understand that xlswrite accepts only explicitly written cells
> > as in Example 2 of the help window, but I don't know how to
> > deal with this case where there is a string (C). Please help, jay.
>
> an attempt:
> for i=1:3
> dd{i,1}=C{i};
> dd{i,2}=num2str(i);
> end
>
> s=xlswrite('your.xls',dd)
>
> hth
> kinor
Thanx kinor, however I needed a somewhat different problem to solve, that is:
C={'Arts','Science','Cinema'};
for i=1:3
disp([C(1:i),num2str(1:i)])
end
'Arts' '1'

'Arts' 'Science' '1 2'

'Arts' 'Science' 'Cinema' '1 2 3'
and I'm still in shambles, because I cannot save in excel this output. Regards, GT.