Read c3d-files into Matlab
显示 更早的评论
I have two directories of data: 'data_stair_rise' and 'data_sts'. Each directory contains 5 subfolders: 'pp1', 'pp2', 'pp3', 'pp4' en 'pp5'. Each subfolder contains some '.c3d-files'. (see attachment).
We need to read these files into Matlab. The teacher gave us a function who can read these c3d-files, but we need to create 5x5 struct (5 subjects x 5 measurements). (see attachment).
I don't have ANY idea how to start... Please help.
2 个评论
Suad Abu Shaar
2023-5-24
Can you share the command used to read the c3d file please
Image Analyst
2023-5-24
@Suad Abu Shaar, @Sam had a function he called "read_c3d_file" but he never attached it. And since it's 9 years later, I doubt he ever will.
回答(2 个)
Image Analyst
2014-12-24
0 个投票
I don't know what's in the file. In a single .c3d file, how many subjects, and how many measurements are in it?
When you use your teacher's function, what kind of variable does the file get read in to? A single structure? An array of structures? We have no idea, but you should since you and your teacher have the code.
8 个评论
Sam
2014-12-25
Image Analyst
2014-12-25
If you have questions still after reading the FAQ, come back and ask. http://matlab.wikia.com/wiki/FAQ#How_can_I_process_a_sequence_of_files.3F
Sam
2014-12-25
Image Analyst
2014-12-25
I'm not sure how a 5x5 struct array holds 6 things. But you can just dynamically create indexes and fields, like
for col = 1 : 5
for row = 1 : 5
sa(row, col).field1 = thing1; % Whatever this is.
sa(row, col).field2 = thing2; % Whatever this is.
sa(row, col).field3 = thing3; % Whatever this is.
sa(row, col).field4 = thing4; % Whatever this is.
sa(row, col).field5 = thing5; % Whatever this is.
sa(row, col).field6 = thing6; % Whatever this is.
end
end
You can call the fields whatever you want and somehow read the 6 "things" from your data file before assigning them to the structure array, sa. I don't really know what rows and columns represent but I guess you will. Add a third index to sa if you need to, to represent the four cd3 files for each subject.
Sam
2014-12-25
Image Analyst
2014-12-25
First of all, let's not call it a cell since it's not. That's an entirely different animal One element of a structure array is a structure, not a cell.
In your loop, the values like VideoSignals are not changing. Why not? Well it's because they're always the same since there were assigned before the loop. If you want different ones, then you have to call read_c3d_file() INSIDE THE LOOP, not prior to it. Don't you understand that if you call read_c3d_file() before then those values will be the same no matter how many times you iterate a loop? Why should they change? They won't , unless you update them with a call to read_c3d_file().
Walter Roberson
2023-5-24
0 个投票
see https://www.mathworks.com/matlabcentral/fileexchange/69372-ezc3d
and tools listed at https://www.c3d.org/c3dapps.html
类别
在 帮助中心 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!