Convert a date into seconds from a string from a block "constant"
Afficher commentaires plus anciens
I am trying to convert a date in the form 'DD.MM' - set in a constant block - into seconds in Simulink (so that the user can change it quickly). I found the following guidelines to solve the issue by it still does not get through. 1. In the block I entered uint8(DD/MM) 2. Here is the code in the function: function seconds = fcn(date) coder.extrinsic('sscanf'); coder.extrinsic('datenum'); seconds=0; sscanf(date,'%d.%d'); seconds= datenum(date,24); end
I got the following error: "First argument must be a string."
Any hint?.
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur String dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!