Reodering/Swapping Arrays in a struct
Afficher commentaires plus anciens
Hello Everyone, I am new to matlab. I am having a problem which is reodering the arrays in a structure by taking in user input.
What I mean is user will enter some values in a vector and according to them, arrays in the struct should be reodered.
As you can see in the pictures, the vector given by the user is 1x7 and the struct is 7x1 and I want to reoder the arrays in the struct according to the vector.
My vector is named as "a" and the struct is named as "out"
Now my code is:
for i = 1:7
a(i) = input('Input a number: ');
if (a(i) > 7)
{ error('Value exceeds the Number of Struct Rows')
}
end
end
for i =1:7
out(a(i)) == out(i)
end
this is a vector givien by the userthis is the struct, which I have

The error I am getting is
"Undefined operator '==' for input arguments of type 'struct'."
I donnot know how to resolve it or what is wrong in my code
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Matrix Indexing dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
