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
0 个评论
采纳的回答
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Spreadsheets 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!