Message Boards Message Boards

0
|
1835 Views
|
2 Replies
|
1 Total Likes
View groups...
Share
Share this post:

[?] Access elements of a QuantityArray?

Posted 5 years ago

Hi, How do I access the individual elements of a QuantityArray? For example, if I initialize an array:

temps=QuantityArray[ConstantArray[0,5],"Kelvins"]

and then I'd like to change the third element of temps to 273 K.

Thanks, Tony

POSTED BY: Tony Marino
2 Replies
Posted 5 years ago

Thanks Henrik! That's perfect.

POSTED BY: Tony Marino

I guess you are asking for ReplacePart, e.g. try:

temps = QuantityArray[ConstantArray[0, 5], "Kelvins"];
temps = ReplacePart[temps, 3 -> Quantity[273, "Kelvins"]];
temps[[3]]
POSTED BY: Henrik Schachner
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract