Group Abstract Group Abstract

Message Boards Message Boards

0
|
3.8K Views
|
3 Replies
|
3 Total Likes
View groups...
Share
Share this post:

[?] Store vectors as columns of a matrix?

Posted 6 years ago

Hello everyone.

I have constructed a for loop which offers a vector as a result. These vectors have a leght of 101 and there are 9 iterations of the loop.

I now need to save the value of the vector at each loop, which is "ArrayReshape[{realizationXYActualR}, {longitud, 2}]". I have tried to store them as columns of a matrix called matRealizations as matRealizations[[All, i]], being i the variable of the loop, also matRealizations[[i]] and all other combinations of brackets. Hoever, error messages arise.

If someone could please tell me how to save the different values of this vector I would be extremely thankful.

I will also attach my code just in case someone wants to take a look at it.

Thanks. Jaime.

POSTED BY: Jaime de la Mota
3 Replies

Jamie,

Actually, you really only need to fill it with enough columns. In MMA the columns can be different lengths so you can experiment if there is a timing difference one way or the other.

Regards,

Neil

POSTED BY: Neil Singer

Thank you very much Neil. It works perfectly.

Regards. Jaime.

POSTED BY: Jaime de la Mota

Jamie,

You can't use the matRealizations[[All, i]] construct unless you first initialize matRealizations. Use something like:

matRealizations = ConstantArray[0, {dim1, dim2}];

where dim1 and dim2 are your array dimensions.

Regards,

Neil

POSTED BY: Neil Singer
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard