필터 지우기
필터 지우기

System date and time in XPC target model

조회 수: 1 (최근 30일)
Jan De Vries
Jan De Vries 2012년 8월 28일
I need to get the system date and time in my simulink model, which is used for XPC target. In simulink, this is not a problem, using the embedded matlab function with the following code:
function [Y, M, D, H, MN, S] = sysClock()
coder.extrinsic('clock');
Y = 0;
M = 0;
D = 0;
H = 0;
MN = 0;
S = 0;
[Y, M, D, H, MN, S] = clock;
end
However, this block gives me error messages when I try to compile it to XPC. Is there another way? Or do I need to change the code? Shouldn't be such a difficult problem I would say...
Thanks!!

채택된 답변

Jan De Vries
Jan De Vries 2012년 8월 28일

추가 답변 (1개)

Jan De Vries
Jan De Vries 2012년 8월 28일
Thanks, but when I try to mex xpcwalltime.c, I receive the following error:
Error xpcwalltime.c: 122 type error in argument 3 to a function; found `int' expected `pointer to const struct DimsInfo_tag'
Error xpcwalltime.c: 172 type error in argument 3 to `_ssSetOutputPortVectorDimension'; found `pointer to struct DimsInfo_tag' expected `int'
Warning xpcwalltime.c: C:\PROGRA~1\MATLAB\R2011B\simulink\include\simulink.c: 2481 assignment of pointer to void function(pointer to struct SimStruct_tag,int,pointer to const struct DimsInfo_tag) to pointer to void function(pointer to struct SimStruct_tag,int,pointer to struct DimsInfo_tag)
Warning xpcwalltime.c: C:\PROGRA~1\MATLAB\R2011B\simulink\include\simulink.c: 2485 assignment of pointer to void function(pointer to struct SimStruct_tag,int,pointer to const struct DimsInfo_tag) to pointer to void function(pointer to struct SimStruct_tag,int,pointer to struct DimsInfo_tag)
2 errors, 2 warnings
C:\PROGRA~1\MATLAB\R2011B\BIN\MEX.PL: Error: Compile of 'xpcwalltime.c' failed.
Error using mex (line 206)
Unable to complete successfully.
I use XPC target 5.1 FWIW
  댓글 수: 2
Kaustubha Govind
Kaustubha Govind 2012년 8월 28일
Where do you get xpcwalltime.c from? The file in the above solution is named xpctimeofday2.c, and I am able to compile it successfully with the mex command.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Reporting and Database Access에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by