psychopy.org | Reference | Downloads | Github

Saving to file - csv / Excel

Hi all,

I’m having difficulty trying to save a 6x6 array that is filled with 0’s and 1’s. Ive converted the relevant variable into str(flat_grid) + ‘\n’ but when i then open the CSV file and convert it in Excel the 0’s and 1’s fill numerous columns instead of just one column that should contain all the relevant 0’s and 1’s in one cell.

I essentially want the below printed in one cell.
[[ 0. 1. 0. 0. 0. 0.]
[ 0. 0. 0. 0. 0. 0.]
[ 1. 0. 0. 1. 0. 0.]
[ 0. 0. 0. 0. 0. 0.]
[ 0. 0. 0. 1. 0. 0.]
[ 0. 0. 0. 0. 0. 0.]]

Is there anyway i can make the relevant changes in psychopy or Excel.

Any suggestions are greatly appreciated.

Hi @nottchris, so you want a single cell to contain a 6 x 6 array? If so, you could try using openpyxl - see attached oneCell.py (382 Bytes)