필터 지우기
필터 지우기

Error: Dot indexing is not supported for variables of this type.

조회 수: 1 (최근 30일)
yutong wu
yutong wu 2019년 5월 22일
댓글: yutong wu 2019년 5월 22일
Dear community, when I add a row to a matrix in structure parameter,
a = ones(1,5);
parameter.A = [parameter.A; a];
the following error occurs: Dot indexing is not supported for variables of this type. I don't know how to modify it.
  댓글 수: 2
per isakson
per isakson 2019년 5월 22일
편집: per isakson 2019년 5월 22일
Show us the results of
whos parameter
and
parameter
yutong wu
yutong wu 2019년 5월 22일
Sorry, maybe I wasn't being clear. "parameter.A" initial value is []. On each loop iteration, "a" will be changed and I want to record all "a" in the structure matrix "parameter.A".

댓글을 달려면 로그인하십시오.

채택된 답변

per isakson
per isakson 2019년 5월 22일
편집: per isakson 2019년 5월 22일
I cannot reproduce your problem. This works
%%
parameter.A = [];
a = ones(1,5);
parameter.A = [parameter.A; a];
b = 2*ones(1,5);
parameter.A = [parameter.A; b]
and outputs
>> parameter =
struct with fields:
A: [2×5 double]
>> parameter.A
ans =
1 1 1 1 1
2 2 2 2 2
>>
  댓글 수: 1
yutong wu
yutong wu 2019년 5월 22일
Thank you, the expression is okay. I find the reason. I set the structure parameter as [], which lead to the error.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Yuichi Mimura
Yuichi Mimura 2019년 5월 22일
편집: per isakson 2019년 5월 22일
If you simply wish to add row "a" to a part of Structure Array "parameter", the below code will realize this.
a = ones(1,5);
parameter.A = a;
>> parameter.A
ans =
1 1 1 1 1
Can this be your solution?
  댓글 수: 1
yutong wu
yutong wu 2019년 5월 22일
"a" will be changed in a loop. I need to add row "a" to the existing "parameter".

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Call Python from MATLAB에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by