Dot indexing is not supported for variables of this type
Show older comments
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 Comments
Matt J
on 1 May 2021
We cannot run your code (because it is an image).
Lissa
on 1 May 2021
Matt J
on 1 May 2021
Much better, but we also cannot run the code it references files, folder paths, and data that we do not have. Please provide a modification of the code that will reproduce the issue without needing to run in your environment. It would also be a good idea if you would copy/paste the errors you are getting so we know what we should expect.
Lissa
on 1 May 2021
Lissa
on 1 May 2021
Stephen23
on 1 May 2021
Note that rather than using ADDPATH to dynamically add data folders to the MATLAB search path, you should just use absolute/relative filenames (hint: you will need to use FULLFILE). In general the search path should only refer to folders containing code.
Lissa
on 1 May 2021
Answers (1)
Jan
on 1 May 2021
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 Comments
Jan
on 1 May 2021
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;
Categories
Find more on Signal Operations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
