MATLAB Answers

.mf4 file import: Missing scaling for one channel

13 views (last 30 days)
Hello,
we are using the vehicle network toolbox extensively for automated measurement analysis. Now I suddenly have one file where everything looks fine in CANape but one specific channel looses the signal scaling when I import it with mdf() and read(). It shows only digits and not float values (32123 Nm instead of 250.12345 Nm) There seems to be nothing else suspicious when I look into it in CANape or the mdf object. When I save the file as .mat from CANape, the scaling is correct.
This worries me a lot as I have no way to identify and catch such import errors!
Is this a bug or is there some other explanation?
See attached mf4 file for and try yourself (I reduced it to the problematic channel only). I am using Matlab R2019b.
Thanks for any help!
  2 Comments
Frank Wuechner
Frank Wuechner on 20 Jul 2021
Hello,
sorry for that and thanks a lot for looking into it. One more try:

Sign in to comment.

Accepted Answer

Siying Liu
Siying Liu on 21 Jul 2021
Edited: Siying Liu on 21 Jul 2021
Hello Frank,
I understand that the channel in your MDF file contains a linear conversion rule and you were not able to obtain the correctly scaled values using mdf.read from R2019b. This is because processing the MDF conversion rule is not supported until R2021a. Please see the R2021a release note from Vehicle Network Toolbox.
-------------------------------
A temporary workaround would be to manually apply the linear conversion in MATLAB.
If you open your MDF file in Vector MDF Validator, you can check the scale factor for that specific channel:
You could then multiply your data (read by R2019b mdf.read) with this scale number.
Hope this helps!

More Answers (0)

Products


Release

R2019b

Community Treasure Hunt

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

Start Hunting!