Help needed in creating dynamic field names using struct in matrix form.
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Rick
el 24 de Oct. de 2012
Hi,
I am currently using this code:
rename = sprintf('I%inewEp', i);
newData.(rename) = myData.Ep;
newData.(rename(:,1)) = myData.Ep(:,1) - X; %Error starts from here
newData.(rename(:,2)) = myData.Ep(:,2) - Y;
I keep getting errors when the code performs the subtractions.
Any suggestions would be greatly appreciated. Thank you.
0 comentarios
Respuesta aceptada
Andrei Bobrov
el 24 de Oct. de 2012
newData.(rename) = bsxfun(@minus,myData.Ep,[X Y]);
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Structures en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!