Clear Filters
Clear Filters

writing excel file for every iterations

3 views (last 30 days)
clc
clear
clc
A=xlsread('term.xlsx');
[p,q]=size(A);
X=A(:,1);
B = A(:,3);
D=[];
for i= 1:200:2001
X(i)=A(i,1);
B(i)= A(i,3);
D=[D;X(i),B(i)]
end
xlswrite('abc.xlsx',D)
by using this code am only getting last value in my ecel sheet. i want result for every results. could anyone help me thanks in advance musthafa

Answers (1)

Azzi Abdelmalek
Azzi Abdelmalek on 1 May 2015
Edited: Azzi Abdelmalek on 1 May 2015
clc
clear
clc
A=xlsread('term.xlsx');
[p,q]=size(A);
X=A(:,1);
B = A(:,3);
D=[];
for i= 1:200:2001
X(i)=A(i,1);
B(i)= A(i,3);
D=[D;X(i),B(i)]
end
xlswrite('abc.xlsx',D)
%or you can do it simply this way
A=xlsread('term.xlsx');
D=A(1:200:2001,[1 3])
xlswrite('abc.xlsx',D)

Categories

Find more on Data Import from MATLAB in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!