writing excel file for every iterations

3 次查看(过去 30 天)
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

回答(1 个)

Azzi Abdelmalek
Azzi Abdelmalek 2015-5-1
编辑:Azzi Abdelmalek 2015-5-1
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)

类别

Help CenterFile Exchange 中查找有关 Data Import from MATLAB 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by