change a value in row 2 and columne 5 in a structure in matlab

If the structure is called myStruct, and the field you want to change is called fieldToChange, you can change the value in row 2 and column 5 using the following syntax:

main.m
myStruct(2).fieldToChange(5) = newValue;
41 chars
2 lines

This assumes that myStruct is an array of structures, and you want to change the value in the second structure's fieldToChange field in the fifth element of that field. Replace newValue with the new value you want to assign to that location.

related categories

gistlibby LogSnag