Matlab xlsread and add new data to opened file

1 次查看(过去 30 天)
Hello, I'm trying to open certain excel file with xlsread and add user inputs to that file using xlswrite. But when I open excel file after adding new data, I cannot find original data but added ones. Can anybody help me with this?
close all;
clear all;
clc;
[num,txt]=xlsread('filename.xlsx'); %I have both num&txt data, including header
nn=length(txt);
n=nn+1;
A={};
while(1)
m=input('');
if m==1
fprintf('---------------------------\n')
number=input('- Sentence :','s'); %here I'll get number and text data
Anew={number(1:3),number(4),number(5:8)};
A(n,1)=(Anew(1,1)); %num
A(n,2)=(Anew(1,2)); %txt
A(n,3)=(Anew(1,3)); %num
n=n+1;
end
if m==0
xlswrite([num,txt],A); %actually I'm not sure what to write here :(
break;
end
end

采纳的回答

Sindhu Karri
Sindhu Karri 2020-5-29

更多回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by