フィルターのクリア

Dot indexing is not supported for variables of this type

4 ビュー (過去 30 日間)
Lissa
Lissa 2021 年 5 月 1 日
コメント済み: Jan 2021 年 5 月 1 日
The script does create the variable vel. It is a 1x1 struct with data and headers.
Any ideas why the error is still reported? Thanks in advance (script in attachment)
  8 件のコメント
Lissa
Lissa 2021 年 5 月 1 日
編集済み: Lissa 2021 年 5 月 1 日
startpath = 'MATLAB Drive/BIOMECHLISSA/';
datapathvel = [startpath 'BODY KINEMATICS/'];
dataFilevel = fullfile(datapathvel,'3DGaitModel2354-scaled_BodyKinematics_vel_global_SUP_HR_0*.sto');
pathwayvel = dir(dataFilevel)
vel = importdata(fullfile(pathwayvel(k).folder,pathwayvel(k).name));
Yes, I already tried that method but was not sure how you could refer to the .data folder of the struct?
Lissa
Lissa 2021 年 5 月 1 日
clear all
close all
clc
k = 1
startpath = '/MATLAB Drive/BIOMECHLISSA/';
datapathvel = [startpath 'BODY KINEMATICS/'];
dataFilevel = fullfile(datapathvel,['3DGaitModel2354-scaled_BodyKinematics_vel_global_SUP_HR_0' num2str(k) '.sto'])
pathwayvel = dir(dataFilevel)
vel = importdata(fullfile(pathwayvel.folder,pathwayvel.name));
If I run this in a new blank scipt it works fine and the vel variable is the right struct. When I paste it in the other script it still gives the same error of dot indexing not supported for this variable ..

サインインしてコメントする。

回答 (1 件)

Jan
Jan 2021 年 5 月 1 日
vel = importdata(...)
does not create the output vel as a struct in your case. I assume ".sto" files are text files. Then the output ia a matrix.
A bold guess is tha you have to replace
vel_new = vel.data(starttimeOS:end,17);
by
vel_new = vel(starttimeOS:end,17);
  2 件のコメント
Lissa
Lissa 2021 年 5 月 1 日
編集済み: Lissa 2021 年 5 月 1 日
Hi! I tried to run it but it is only working when I write k = 1, it returns the error message when I fill in k = 2 ..
But the files etc are present in the folder for T2 as well .. Thanks in advance!
Jan
Jan 2021 年 5 月 1 日
Please do not post code as screenshot. Posting it as text allows the readers to write an answer by copy&paste.
Your code still contains "vel.data". My suggestion was to omiut the ".data". Did you try this already?
I cannot know, what files type you import. Maybe some ate text files (which are imported as matrices) and others are MAT or XLSX files, which are imported as structs. For efficient work he command importdata is too powerful, because it tries to import the file with automagic guessing of what the user might need. This is finde for a short hack, if the user knows exactly what to do. For scientific work a specific import routine would be much safer.
By the way:
time_vel = 0.01:0.01:length(vel.data(starttimeOS:end,1))/100;
The length of the vector (vel.data(starttimeOS:end,1)) can be determined by:
size(vel.data, 1) - starttimeOD + 1;

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeDynamic System Models についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by