Effacer les filtres
Effacer les filtres

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

1 vue (au cours des 30 derniers jours)
yutong wu
yutong wu le 22 Mai 2019
Commenté : yutong wu le 22 Mai 2019
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 commentaires
per isakson
per isakson le 22 Mai 2019
Modifié(e) : per isakson le 22 Mai 2019
Show us the results of
whos parameter
and
parameter
yutong wu
yutong wu le 22 Mai 2019
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".

Connectez-vous pour commenter.

Réponse acceptée

per isakson
per isakson le 22 Mai 2019
Modifié(e) : per isakson le 22 Mai 2019
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 commentaire
yutong wu
yutong wu le 22 Mai 2019
Thank you, the expression is okay. I find the reason. I set the structure parameter as [], which lead to the error.

Connectez-vous pour commenter.

Plus de réponses (1)

Yuichi Mimura
Yuichi Mimura le 22 Mai 2019
Modifié(e) : per isakson le 22 Mai 2019
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 commentaire
yutong wu
yutong wu le 22 Mai 2019
"a" will be changed in a loop. I need to add row "a" to the existing "parameter".

Connectez-vous pour commenter.

Catégories

En savoir plus sur Call Python from MATLAB dans Help Center et File Exchange

Tags

Aucun tag saisi pour le moment.

Community Treasure Hunt

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

Start Hunting!

Translated by