Clear Filters
Clear Filters

Getting this error: Unrecognized field name "absolut".

3 views (last 30 days)
for i = 1: length(selected_list)
Speicher_Ort =Bracket_seperation(selected_list{i});
row = Speicher_Ort(1);
col = Speicher_Ort(2);
if strcmp(plot_data_type,'X')
plot(percentage * CEU_X(row,col).absolut(2,1:8000),...
percentage * CEU_X(row,col).absolut(1,1:8000),'r');
hold on;
end
end
Actually this code works perfectly before but suddenly I am geeting this error. please let me know, why i am getting this error?
  5 Comments
Dhaval
Dhaval on 17 Jul 2023
Edited: Dhaval on 17 Jul 2023
yes, field name is correct.
plot(percentage * CEU_X(row,col).*absolut(2,1:8000),...
percentage * CEU_X(row,col).*absolut(1,1:8000),'r');
after using this I got this error : Operator '*' is not supported for operands of type 'struct'.
Dyuman Joshi
Dyuman Joshi on 17 Jul 2023
Can you attach the variable CEU_X? Use the paperclip button to attach the file.

Sign in to comment.

Accepted Answer

Image Analyst
Image Analyst on 15 Jul 2023
CEU_X evidently does not have a field called that. What does this show
whos CEU_X
CEU_X
if you type those into the command window.
  2 Comments
Image Analyst
Image Analyst on 17 Jul 2023
What does this show in the command window
fieldnames(CEU_X)
when you type that in the command window or put it into the script before the error?
If absolut is a field, then you can do
percentage * CEU_X(row,col).absolut(2,1:8000)
like you originally did but not
percentage * CEU_X(row,col).*absolut(2,1:8000)
like you did later.
percentage * CEU_X(row,col).absolut(2,1:8000) says you're taking elements 1-8000 of row 2 of the field absolut of the structure CEU_X, where as CEU_X(row,col).*absolut(2,1:8000) says you're going to take a whole cell (not the contents of the cell like you'd get if you had used curley braces) and then multiplying it by absolut (an 8000 element row vector). You can't multiply a cell by anything. You can only multiple contents of cells if they are numbers. See the FAQ for info on when to use braces, brackets, and parentheses:

Sign in to comment.

More Answers (0)

Categories

Find more on Startup and Shutdown in Help Center and File Exchange

Products


Release

R2022b

Community Treasure Hunt

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

Start Hunting!