フィルターのクリア

an element of a cell array doesn't appear when I send to excel file

1 回表示 (過去 30 日間)
AMINE EL MOUATAMID
AMINE EL MOUATAMID 2019 年 4 月 30 日
コメント済み: AMINE EL MOUATAMID 2019 年 4 月 30 日
dddddd.PNG I want to change out(8,2) to be 'S-PC-K6301'
rrrrr.PNG I use this trick
ggggg.PNG it becomes like this
but when I send the cell array to my excel file it appears like this rerrrrr.PNG
can someone explain why this happens ?
  2 件のコメント
Adam Danz
Adam Danz 2019 年 4 月 30 日
Could you share the section of code that changes the cell value and writes to the excel file?
AMINE EL MOUATAMID
AMINE EL MOUATAMID 2019 年 4 月 30 日
%% put data from RMS to out
j=1;
i=2;
while i <= sizeOut(1,1)
if all(~isnan(out{i,2}))&& contains(out{i,2},serie)
for j=j+1 : rowRMS(1,1)
if all(~isnan(out{i,1})) && contains(out{i,1},RMS{j,1})
for k=9:16
if all(~isnan(out{i,k})) && contains(out{i,k},PointName)
if all(~isnan(out{i+1,8})) && contains(out{i+1,8},MeasTypeID)
out{i+1,k}=RMS{j,2};
break
else
if all(~isnan(out{i+2,8})) && contains(out{i+2,8},MeasTypeID)
out{i+2,k}=RMS{j,2};
break
else
if all(~isnan(out{i+3,8})) && contains(out{i+3,8},MeasTypeID)
out{i+3,k}=RMS{j,2};
break
end
end
end
end
end
else
for n=2 : sizeOut(1,1)
if all(~isnan(out{n,1})) && contains(out{n,1},RMS{j,1})
out=insertrows(out,out(n:7,1:27),n+5);
for k=9:16
if all(~isnan(out{n+6,k})) && contains(out{n+6,k},PointName)
if all(~isnan(out{n+7,8})) && contains(out{n+7,8},MeasTypeID)
out{n+7,k}=RMS{j,2};
break
else
if all(~isnan(out{n+8,8})) && contains(out{n+8,8},MeasTypeID)
out{n+8,k}=RMS{j,2};
break
else
if all(~isnan(out{n+9,8})) && contains(out{n+9,8},MeasTypeID)
out{n+9,k}=RMS{j,2};
break
end
end
end
end
end
closeexcel;
data=zeros(6,27);
xlsappend(File,data,'relevés journalier');
Excel = actxserver('Excel.Application');
Workbooks = Excel.Workbooks;
% Open Excel file
Workbook=Workbooks.Open(File);
% Tell it to not wait and pop up alerts like "This file exists. Do you want to overwrite it.
Excel.DisplayAlerts = false;
% Specify sheet number,and range to write to
%%sheetnum = InputBox(Excel,'numero de fenêtre :','Ma boite de dialogue',[],[],[],[],[],1)
%%range = 'A1:AA3458';
% Make the first sheet active
Sheets = Excel.ActiveWorkBook.Sheets;
sheet1 = get(Sheets, 'Item','relevés journalier');
invoke(sheet1, 'Activate');
Activesheet = Excel.Activesheet;
DataRange = Excel.ActiveSheet.UsedRange;
r = DataRange.Address;
r1 = regexp(r, ':', 'split');
end_cell = regexprep(r1{2}, '\$', '');
start_cell = 'A1';
range = [start_cell ':' end_cell];
break
end
end
C='S-PC-';
serie=cellstr(serie);
out{n+6,2}=strcat(C,serie);
%%out{n+6,2}=cellstr(out{n+6,2});
end
break
end
end
sizeOut=size(out);
i = i+1;
end
%%
%Put MATLAB data into Excel
ActivesheetRange = get(Activesheet,'Range',range);
set(ActivesheetRange, 'Value', out);
Excel.ActiveWorkbook.Save;
%%
ActivesheetRange = get(Activesheet,'Range',range);%%
set(ActivesheetRange, 'Value',out);
%%
%Close Excel and clean up
closeexcel;
%%clear all;

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeSpreadsheets についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by