I had some problems running this function. First of all, please change the name of the function in 'export2spss' instead of 'save4spss'. Secondly 'names' and 'vars' should be interchanged according to the help of this function.
After these changes the function works perfectly. Note: I had to close Matlab before SPSS was able to import the data.
Thanks! This is a great idea and works like a treat.
To run on a mac (or under linux) the slashes in file paths have to be changed accordingly. If they are replaced by the wildcard 'filesep' it automatically uses the appropriate ones and the function can be used under unix and windows. (The .sps isn't opened automatically under unix but that's just one click)