Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
lhw0719
Level 1
Level 1
5 sign-ins First reply posted First question asked

Hi,I want to extract raw data from Position2Go by using official matlab api.

I modified PlotDemo.m to achieve a continuous extraction of the raw data, as shown in the picture, I only modified the third part of the program to include a for loop and to use the ydata matrix to store the data. However, the for loop reports an error at a different i value every time, because the mxRawData matrix is an empty matrix and cannot be assigned to the ydata matrix. I would like to ask why is this? And how can I take a longer section of raw data?

 

0 Likes
1 Solution
Owen_Su
Moderator
Moderator
Moderator
250 solutions authored 500 replies posted 50 likes received

Hi, @lhw0719 ,

    Firstly, you can see from the figure below. mxRawData is a matrix with 2 rows and 256 columns, if you want to use a for loop to get the data, you should add an i to mxRawData, like mxRawData(i,:). Otherwise, you will encounter an error with conflict matrix size.  mxRawData应该也要加上循环参数i。

Owen_Su_0-1682573279845.png

Owen_Su_1-1682573687160.png

    Second, you need to know how many numbers mxRawData will output per loop, use the method I told you before to check. And then modify your equation to fit the size of the matrix on both sides. 先看每次循环mxRawData输出几个数然后来修改你的公式。

BR,

Owen

View solution in original post

0 Likes
4 Replies
Owen_Su
Moderator
Moderator
Moderator
250 solutions authored 500 replies posted 50 likes received

Hi, @lhw0719 ,

    1) Can you show us the error log ?

    2) You should first confirm  the size of  'mxRawData' , use the code below to check the output of mxRawData per loop. If the parameter sizes on both sides of the equation are different, then you should change your equation of ydata.

    确认mxRawData的size,利用代码将每次循环mxRawData的值输出到command window。如果等式两边,也就是ydata和mxRawData的大小不同就会出现报错,这时需要修改赋值的语句。

 

Owen_Su_1-1682313528822.png

    3) Check the definition of ydata, maybe there is a size conflict between different files. Simply, you can change the name in your codes. Hope this can help you.

BR,

Owen

0 Likes
lock attach
Attachments are accessible only for community members.
lhw0719
Level 1
Level 1
5 sign-ins First reply posted First question asked

Hi @Owen_Su ,

The screenshot shows the error message. Each time the error is reported, the i value in the right workspace is different, indicating that the program stops at a different i value, and sometimes the program can run through 1000 loops.At the moment it seems that the get_frame_data function outputs an empty mxRawData result when the program reaches a certain loop.

The size of the ydata matrix is the same as the size of the mxRawData matrix. ydata is initialized using the zeros function, i.e., the matrix is initially all 0.

The source code is in the zip archive.

Looking forward to hearing from you.

0 Likes
Owen_Su
Moderator
Moderator
Moderator
250 solutions authored 500 replies posted 50 likes received

Hi, @lhw0719 ,

    Firstly, you can see from the figure below. mxRawData is a matrix with 2 rows and 256 columns, if you want to use a for loop to get the data, you should add an i to mxRawData, like mxRawData(i,:). Otherwise, you will encounter an error with conflict matrix size.  mxRawData应该也要加上循环参数i。

Owen_Su_0-1682573279845.png

Owen_Su_1-1682573687160.png

    Second, you need to know how many numbers mxRawData will output per loop, use the method I told you before to check. And then modify your equation to fit the size of the matrix on both sides. 先看每次循环mxRawData输出几个数然后来修改你的公式。

BR,

Owen

0 Likes
Owen_Su
Moderator
Moderator
Moderator
250 solutions authored 500 replies posted 50 likes received

    This thread will be closed due to long time no reply, you can create a new one if you have any other questions. Thanks for your understanding.

BR,

Owen

0 Likes