Insert the date and time on an excel file from a .mat file
1 回表示 (過去 30 日間)
古いコメントを表示
Hi,
I wrote a script that converts a .mat file into an Excel file:
% --- Executes on button press in Push
function Push_Callback(hObject, eventdata, handles)
g = get(handles.Push,'value');
if g == 1
%%Stop the simulation
set_param('MAJ','SimulationCommand','stop');
stop(handles.t);
set(handles.Stop,'BackgroundColor', 'red');
%%%%%%%%%%%%%%%%%%%%%%%%%%%
data=load('Exchange(1).mat');
h=fieldnames(data);
for k=1:size(h,1)
T = {'TIMER'};
A = {'FT5Lock'};
xlswrite('Suivi_monitoring.xlsx',data.(h{k}),'sheet_A', 'B1')
xlswrite('Suivi_monitoring.xlsx', T , 'sheet_A', 'A1')
xlswrite('Suivi_monitoring.xlsx', A , 'sheet_A', 'A2')
end
winopen Suivi_monitoring.xlsx
end
where the first line indicates the simulation time. I want to know if there is a possibility to indicate in the first line the system time (HH: MM: SS) instead of the simulation time?
I know there are quite a few functions dedicated to return the current time and date of the system like "clock" but I do not know how to do it.
2 件のコメント
Rik
2017 年 9 月 20 日
What is your question exactly? Do you want to get the system time and convert to a string of the 'HH:MM:SS' format? If so, just take a look at the datestr family of functions.
回答 (1 件)
Jan
2017 年 9 月 20 日
date = m2xdate(now);
xlswrite('Suivi_monitoring.xlsx', date, 'sheet_A', 'B1')
Or if you do not have the Financial Toolbox use this relation:
sdate_Matlab = sdate_Excel + 693960;
参考
カテゴリ
Help Center および File Exchange で Spreadsheets についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!