From: luigi vacca on
Hi there,

I have a structure array Stock(1).Return, Stock(2).Return etc.
I'd like to print the returns in one block to a .csv file.

I tried SUCCESS = xlswrite('ret.csv',{stocks.Returns});

but it does not work.

Your help will be appreciated.

L
From: Ashish Uthama on
luigi vacca wrote:
> Hi there,
>
> I have a structure array Stock(1).Return, Stock(2).Return etc.
> I'd like to print the returns in one block to a .csv file.
>
> I tried SUCCESS = xlswrite('ret.csv',{stocks.Returns});
>
> but it does not work.
>
> Your help will be appreciated.
>
> L

>> Stocks(1).Return=1;
>> Stocks(2).Return=2;

%transpose to make it a column
>> csvwrite('returns.csv',[Stocks.Return]');

>> type returns.csv

1
2


From: us on
"luigi vacca" <vaccaphd(a)aol.com> wrote in message <i2sorc$2ei$1(a)fred.mathworks.com>...
> Hi there,
>
> I have a structure array Stock(1).Return, Stock(2).Return etc.
> I'd like to print the returns in one block to a .csv file.
>
> I tried SUCCESS = xlswrite('ret.csv',{stocks.Returns});
>
> but it does not work.
>
> Your help will be appreciated.
>
> L

one of the solutions

s.a=1;
s.b=magic(3);
c=struct2cell(s);
% now, XLSWRITE(...,C,...)

us