다음 while 루프에서 이미지를 읽고 분석 한 다음 결과를 Excel 워크 시트에 저장된 테이블에 저장합니다. 처음에 하나의 이미지/테이블에 대해이 코드를 작성한 다음 n 개의 이미지 용으로 개발해야한다는 것을 깨달았습니다.MATLAB : while 루프를 사용하여 Excel에서 여러 테이블 저장
기본적으로 결과는 동일한 Excel 워크 시트에 덮어 쓰지 않고 저장되는 것이 좋습니다. 이상적으로 테이블은 빈 행으로 세로 구분됩니다.
while(1)
...
%code code code
...
message = sprintf('Do you want to save the results in an Excel
worksheet?');
reply = questdlg(message,'Run Program?','OK','Cancel', 'OK');
if strcmpi(reply, 'Cancel')
% User canceled so exit.
return;
end
% Table creation.
% code code code
% Saving table to Excel
T = table(Diameter,BandWidth,n1,n2,P1,P2,Damage,...
'RowNames',Band);
filename = 'Results.xlsx';
writetable(T, filename, 'Sheet',1, 'Range', 'A1','WriteRowNames',true);
% Create a while loop to save more experiments to the Excel worksheet.
promptMessage = sprintf('Do you want to process another photo?');
button = questdlg(promptMessage, 'Continue', 'Continue', 'Cancel',
'Continue');
if strcmpi(button, 'Cancel')
break;
end
end
당신이 아이디어를 얻을하는 데 도움이 될 수있는 경우는, 각 테이블은 6 × 8 인 :
여기에 지금과 같은 내 노력입니다.
결과 테이블에 행을 추가하고 처리가 완료되면 Excel에 쓸 수는 없습니까? 도움을 주신 덕분에 – excaza