Kinarm | Interactive Robotics Brain Injury Research

  • Products
  • Clinical Applications
  • News
  • Support
  • About Us
  • Contact

Mobile nav

Using a .mat dataset for a KinArm model

Using a .mat dataset for a KinArm model

Posted on Jun 22, 2022

DWQA Questions › Category: Kinarm End-Point Lab › Using a .mat dataset for a KinArm model
0 Vote Up Vote Down
Rauf Iftikhar asked 9 months ago

I have a .mat dataset (2 columns) that I wish to interpolate and create a Simulink lookup table. This lookup table would then provide output loads on the KinArm based on input position data.

In simulink, running such a model requires loading the dataset into the MATLAB workspace. Is it possible to reference an external file within an .mldatx file? If the .mat file is in the task folder, will the task be able to run?

Thanks,

Rauf

Question Tags: external dataset
1 Answers
0 Vote Up Vote Down
Koloman Varady Staff answered 9 months ago

Hi Rauf,

It is possible for the task, while running in real time, to read from a file (1 to 5 files, in fact). The files have to be converted to binary format first though.

Our sample task here https://kinarm.com/task/input-file-example-drawing-hand-paths/ shows how to load and read a file in a task. The sample tasks also includes a demo .M file for creating a binary file out of a vector of doubles.

Let me know if you have any questions.

Cheers,
Koloman

Rauf Iftikhar replied 9 months ago

Thanks for this answer. If I have multiple matrices stored in the .mat file, how will I know how to index into each specific one? How can I see the structure of the converted data?

Koloman Varady Staff replied 9 months ago

Since you create the binary format file, it’ll be up to you what the structure is. In the example, the binary file is just singles and they’re read one at a time per ms. You can have up to 5 files, so if you have rows you could put each in a file. If not, you could do column-major or row-major format.

Rauf Iftikhar replied 9 months ago

Currently I take a .mat file of 3 2 column matrixes and convert it into 3 corresponding binary .dat files with each value stored as a single (float32) so that I can output both values from each row in each byte. In my model I then unpack and convert. If I want the first column to be the xdat/breakpoints for a lookup table and the second column to be the ydat/table data, how can I achieve this? I tried to use a dynamic lookup table, but because the input file only reads a byte at a time we only pass a single value to the xdat and ydat at a time, which causes an error (“breakpoint and table port cannot be scalar”). I want to load the entire data set and then pass the respective vectors to a lookup table, not pass each individual value as it is read in. Is this possible?

Koloman Varady Staff replied 9 months ago

It depends on how big your matrices are. In the example task, the reading doesn’t start until the Go button is pressed in Dexterit-E (this is because it is an enabled subsystem that is taking a signal from Stateflow, which doesn’t start to execute until the Go button is pressed. If you remove that enable, the code will start to execute as soon the task is loaded (when you double click or select the task in Dexterit-E or when it finishes executing, it will also reload). So you could have the task load, wait 2 seconds, and have 6000 elements from your matrices loaded.

Support

  • User Guides & Documentation
  • Software Downloads
  • Install/Maintain Your KINARM Lab
  • Training Videos
  • New User Training
  • Creating Custom Tasks
  • Sample Custom Tasks
  • Q&A Forum
  • Publications by Research Area

Products

  • Platform Comparison
  • Kinarm Exoskeleton Lab
  • Kinarm End-Point Lab
  • Kinarm Standard Tests
  • Dexterit-E
  • Dexterit-E Explorer
  • NHP Kinarm Exoskeleton Lab

Clinical Applications

  • Clinical Applications
    • Stroke and TIA
    • Traumatic Brain Injury (TBI)
    • Neurological Disease
    • Pediatric
    • Primarily Non-Neurological
  • Clinical Research Sites
  • Publications

News

  • Kinarm News
  • Events
    • Neuroscience
    • Kinarm Camp
  • Product Notices
  • @KinarmLab Twitter Feed
  • Open Jobs

Support

  • Kinarm Help & Support
  • User Guides & Documentation
  • Software Downloads
  • Installing & Maintaining Your Kinarm Lab
  • Training Videos
  • New User Training
  • Creating Custom Tasks
  • Sample Custom Tasks
  • Q&A Forum

About Us

  • About Us
  • Our People
  • Quality
  • Supplier Requirements
  • End-User License Agreement
  • Intellectual Property
  • Privacy & Terms

Contact

  • Contact Kinarm
    • International Sales Agents
  • Request an Account
footer-logo

140 Railway St. Kingston, ON K7K 2L9 Canada Toll Free: (888) 533-4393 Phone: (613) 507-4393 info@kinarm.com

© Copyright BKIN Technologies. All Rights Reserved

Quality | Privacy Policy | Web design/development by 1dea Design + Media Inc.