From: John on
Hello,

I am trying to export columns in an array ( array = file(:,1,2,3,4...)) and plot it in excel using matlabs activex. This is what I am doing so far...

[file] = xlsread(b);
%where 'b' is a unknown column size/row size excel tab delimited file


e = actxserver('excel.application');
eWs = e.Workbooks;
eW = eWs.Add;
eS = eW.ActiveSheet;
e.Visible = 1;


eS.Range('A1:A100').Value = x;

eCO = eS.ChartObjects.Add(100, 30, 400, 250);
eCO.Chart.ChartWizard(eS.Range('A1:A100'));
eCO.Chart.ChartType = 1; % view the chart before moving on


The problem is the range. I need a way to say A1:A100 or A1:A1000. Whatever the case my be.

Ive tried to base this off of a variable base concept, ie:

a(1) = 'A'
b(2) = 'B'
....
sizenum = length(file)
input = a(1)1 ':' a(1)sizenum
eS.Range(input).Value = x;

does this make sense? Sorry if it is just an odd syntax but I am lost.

Regards,
Clay
From: Murugaiyan on
lost ,try this

e = actxserver('excel.application');
eWs = e.Workbooks;
eW = eWs.Add;
eS = eW.ActiveSheet;
e.Visible = 1;

alp=input('Enter the col field ','s')
a(1) = alp
startnum=input('Enter the start field ')
sizenum =input('Enter the end field ');

str=sprintf('%s%d:%s%d',a,startnum,a,sizenum);
eS.Range(str).Value = x;

eCO = eS.ChartObjects.Add(100, 30, 400, 250);
eCO.Chart.ChartWizard(eS.Range(str));
eCO.Chart.ChartType = 1;

"John " <astro_nut(a)hotmail.com> wrote in message <i2q71u$i2p$1(a)fred.mathworks.com>...
> Hello,
>
> I am trying to export columns in an array ( array = file(:,1,2,3,4...)) and plot it in excel using matlabs activex. This is what I am doing so far...
>
> [file] = xlsread(b);
> %where 'b' is a unknown column size/row size excel tab delimited file
>
>
> e = actxserver('excel.application');
> eWs = e.Workbooks;
> eW = eWs.Add;
> eS = eW.ActiveSheet;
> e.Visible = 1;
>
>
> eS.Range('A1:A100').Value = x;
>
> eCO = eS.ChartObjects.Add(100, 30, 400, 250);
> eCO.Chart.ChartWizard(eS.Range('A1:A100'));
> eCO.Chart.ChartType = 1; % view the chart before moving on
>
>
> The problem is the range. I need a way to say A1:A100 or A1:A1000. Whatever the case my be.
>
> Ive tried to base this off of a variable base concept, ie:
>
> a(1) = 'A'
> b(2) = 'B'
> ...
> sizenum = length(file)
> input = a(1)1 ':' a(1)sizenum
> eS.Range(input).Value = x;
>
> does this make sense? Sorry if it is just an odd syntax but I am lost.
>
> Regards,
> Clay