Getting this error: Unrecognized field name "absolut".

1 次查看(过去 30 天)
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 个评论
Dhaval
Dhaval 2023-7-17
编辑:Dhaval 2023-7-17
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 2023-7-17
Can you attach the variable CEU_X? Use the paperclip button to attach the file.

请先登录,再进行评论。

采纳的回答

Image Analyst
Image Analyst 2023-7-15
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 个评论
Image Analyst
Image Analyst 2023-7-17
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:

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Startup and Shutdown 的更多信息

标签

产品


版本

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by