Effacer les filtres
Effacer les filtres

Matlab xlsread and add new data to opened file

2 vues (au cours des 30 derniers jours)
Yoobin Lee
Yoobin Lee le 21 Mai 2020
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

Réponse acceptée

Sindhu Karri
Sindhu Karri le 29 Mai 2020

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by