to write to a excel file

조회 수: 2 (최근 30일)
Sajid Afaque
Sajid Afaque 2019년 3월 26일
답변: Raghunandan V 2019년 3월 27일
hi ,
i have enclosed my code below. i am able to read and write to excel file, but the problem is i am able to write only when the excel file is closed.i am not able to read or write when the excel file is open.kindly help
d = {getenv('username') , date , datestr(now, 'HH:MM PM')};
[~, user_id] = xlsread('C:\Users\AFQ1KOR\Desktop\newfolder\kkr.xlsx','A:A');
access = ismember(getenv('username') , user_id );
if access == 1
[~, record] = xlsread('C:\Users\AFQ1KOR\Desktop\newfolder\Book11.xlsx','A:A');
q = size(record, 1);
r = q + 1;
xlswrite('C:\Users\AFQ1KOR\Desktop\newfolder\Book11.xlsx', d,sprintf('A%d:C%d', r, r));
else
errordlg(' please contact sajid for more details','Access denied','modal')
uicontrol(hObject)
end

답변 (1개)

Raghunandan V
Raghunandan V 2019년 3월 27일
There cannot be two users editing a file together. In this case you are one user if the excel is open and Matlab is the other user

카테고리

Help CenterFile Exchange에서 Spreadsheets에 대해 자세히 알아보기

제품


릴리스

R2013b

Community Treasure Hunt

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

Start Hunting!

Translated by