Q:

deal function in Octave not working

I've got a .m file that was written (and works) when run in Matlab, but when I go to run it in Octave, I get an error.  I know the two programs have their differences, I just don't know quite how to re-write the problematic line of code to make it work. 
Here's the code.  The final line is the one that's causing the problems:
dirr = '/my/file/path/'
foldlist = dir([dirr '*.wav']);
foldname={};
[foldname{1:length(foldlist),1}] = deal(foldlist.name)

And here's the error that comes when run:
error: Invalid call to deal.   Correct usage is:
-- Function File: [R1, R2, ..., RN] = deal (A)
-- Function File: [R1, R2, ..., RN] = deal (A1, A2, ..., AN)

Seems simple enough, given the error explanation, I just don't know how to re-write it. 

A:

You should be able to do this:
foldname={foldlist.name};

This would be the better approach in MATLAB as well. 
foldlist.name is a comma-separated list of values.  These are captured in a cell array by putting the curly braces around it.  Equivalent to {a,b,c}. 
The problem with the original code is that, after initializing foldname={}, the indexing foldname{1:length(foldlist),1} is illegal.  MATLAB tends to add empty cells when indexing out of bounds on the left-hand-side of an assignment.  Octave does too, but here there are square brackets around the indexed array, and it seems that Octave doesn’t parse this particular bit in the same way.