| Reference | Downloads | Github

How do I get Psychopy to IGNORE an empty cell and move to the next frame?

I am doing an experiment with sentences of different lengths and some of the columns have empty cells (with no words), I want Psychopy to ignore those cells and go to the next frame/column. When I leave them blank or write NA in the excel file, a “default text” messages appears on the screen of the experiment, and if a leave an space on excel, it stills appears a blank screen waiting for a response.

If this template helps then use it. If not then just delete and start from scratch.

OS (e.g. Win10):
PsychoPy version (e.g. 1.84.x):
Standard Standalone? (y/n) If not then what?:
What are you trying to achieve?:

What did you try to make it work?:

What specifically went wrong when you tried that?:
Include pasted full error message if possible. “That didn’t work” is not enough information.

I think you can ask your loop to finish that routine if the column is empty. So you can put sth like this in the Begin Routine tab:

if my_col_name == '':
    continueRoutine= False

Another method is to use the selected row facility of your loop. You can give the row number of non-empty rows to this box.

I am not sure if I am not doing it correctly, but I wrote the name of my column (W1) in the code component

in begin experiment:

and then:

if W1 == '':
    continueRoutine= False

It doesn’t give me error, but it didn’t do anything, it stills appears “default text”.

Can you send a screenshot of your condition file and your loop/routine?

Moreover, you do not need to write W= True`. W1 is a variable in your condition file and it already existed.

Thanks for replying so promptly!
Here they are, so each column (W1, W2, …, W19) represents a word in a sentence, they are of different length, also few of them have a question at the end, so I have a lot of empty cells that I wish Psychopy just ignored.

I also did erase the W1, and kept only the:

if W1 == ‘’:
 continueRoutine= False

but still nothing…

Screen Shot 2020-03-10 at 1.36.10 AM

Try moving the code element to the top, before the other elements.

I did, nothing …

Screen Shot 2020-03-10 at 2.22.19 PM


can you please check in the pictures above if I wrote the code in the correct place?

Hi @Laura_Pissani. Sorry for my delay in getting back to you. I was super busy today.

Attached you can find a builder experiment. I created a condition with some empty cells and I used a code that I sent you. So, the experiment skips those empty cells in each routine. I hope it is clear.

You can get an idea on how to do this in your experiment.

untitled.psyexp (11.9 KB) conditions.xlsx (8.2 KB)

I ran the experiment in my computer and this appeared (I did not edit anything).
I already figured out a way (creating and additional column with 1 and 0s to tell the program they should only run the 1 cells) BUT your way seemed way better, but I can’t make it work.

That is weird. It worked on my laptop and I had the same issue when I tested it on my desktop. I think the problem is with the empty cells. I put the word “empty” in those empty cells and change the code accordingly. Now, it should work.
conditions.xlsx (8.3 KB) untitled.psyexp (11.9 KB)

It is not working, sadly.
But I already solved it, but it was definitely not the the best way.

@Jon do you know how to make the program ignore empty cells in the text component?

I thought that had been done already, but I’ll check. If not insert a space character in the cell so that it’s jsut invisible