Filter löschen
Filter löschen

Getting this error: Unrecognized field name "absolut".

3 Ansichten (letzte 30 Tage)
Dhaval
Dhaval am 15 Jul. 2023
Kommentiert: Image Analyst am 17 Jul. 2023
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 Kommentare
Dhaval
Dhaval am 17 Jul. 2023
Bearbeitet: Dhaval am 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 am 17 Jul. 2023
Can you attach the variable CEU_X? Use the paperclip button to attach the file.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Image Analyst
Image Analyst am 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 Kommentare
Dhaval
Dhaval am 17 Jul. 2023
It is Struct.
Image Analyst
Image Analyst am 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:

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Startup and Shutdown finden Sie in Help Center und File Exchange

Produkte


Version

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by