The instructions below were provided by Chen DanDan on 2014-11-12 to help
people with compiling on Windows.
However, I (JF) do not advise following the recommendations below
because editing the .c files is unnecessary.  The code is written in C99 and
if you use a C99 compiler it should compile fine without editing the source.

-------------------------

First, modify Makefile-oct to build nufft with matlab mex Lcc.
Below is the file of our Makefile-oct:
-----------------
# Makefile-oct, for octave
# This makefile builds the .mex* files needed for NUFFT interpolation.

#include ../../mex/oct-setup.sh # since we only build c files on matlab, we do not use oct-setup.sh file
#below lines are from oct_setup.sh,we copy them and replace the path with our own path
version = 3.8.1
octlibdir = /opt/local/lib/octave/${version}/
octincdir = E:\PROGRA~1\MATLAB\R2013b\extern\include
export XTRA_CFLAGS=-std=c99 -UCountAlloc -DMmex -DUse_simd -DUse_thread -O3

suf = mexw32  # in matlab, the suffix name of the output binary file is mexw32 in windowsXP system,replace them with your own file suffix

# where to install the compiled mex files:
# for mac:
dir = ../../mex/oct/${Arch}/

mex = mex # we use mex command in matlab
mexo = $(mex) -output # the parameter of mex command output file is -output
mexa = ls

octh = $(octincdir)/mex.h
doth = def,table.h $(octh)

goal:	\
	$(dir)interp1_table_mex.$(suf) \
	$(dir)interp2_table_mex.$(suf) \
	$(dir)interp3_table_mex.$(suf) \
	$(dir)interp1_table_adj_mex.$(suf) \
	$(dir)interp2_table_adj_mex.$(suf) \
	$(dir)interp3_table_adj_mex.$(suf)
	@echo working on $(suf)


i1c = interp1_table1_for.c interp1_table_mex.c
$(dir)interp1_table_mex.$(suf):	$(i1c) $(doth) def,table1.h
	$(mexo) $@ $(i1c)
	$(mexa) $@

i2c = interp2_table1_for.c interp2_table_mex.c
$(dir)interp2_table_mex.$(suf):	$(i2c) $(doth) def,table2.h
	$(mexo) $@ $(i2c)
	$(mexa) $@

i3c = interp3_table1_for.c interp3_table_mex.c
$(dir)interp3_table_mex.$(suf):	$(i3c) $(doth) def,table3.h
	$(mexo) $@ $(i3c)
	$(mexa) $@


a1c = interp1_table1_adj.c interp1_table_adj_mex.c
$(dir)interp1_table_adj_mex.$(suf):	$(a1c) $(doth) def,table1.h
	$(mexo) $@ $(a1c)
	$(mexa) $@

a2c = interp2_table1_adj.c interp2_table_adj_mex.c
$(dir)interp2_table_adj_mex.$(suf):	$(a2c) $(doth) def,table2.h
	$(mexo) $@ $(a2c)
	$(mexa) $@

a3c = interp3_table1_adj.c interp3_table_adj_mex.c
$(dir)interp3_table_adj_mex.$(suf):	$(a3c) $(doth) def,table3.h
	$(mexo) $@ $(a3c)
	$(mexa) $@


reset:
	/bin/rm -i $(dir)interp*table*mex.$(suf)

-----------------

To avoid compile failure, there are some more files in directory of nufft/table that need to be modified:
interp1_table1_adj.c
interp1_table_adj_mex.c
interp1_table_mex.c
interp2_table1_adj.c
interp2_table_adj_mex.c
interp2_table_mex.c
interp3_table1_adj.c
interp3_table_adj_mex.c
interp3_table_mex.c

The main modification is the declaration of some local variables. For example, in file interp1_table_mex.c, we need to modify
	double *r_fm = mxGetPr(plhs[0]);
	double *i_fm = mxGetPi(plhs[0]);
    ......
    for (int nn=0; nn < N; ++nn)
    ......

to place these three variable declarations at the very begining of the function, before Call(...):
    double *r_fm,*i_fm; #at the very begining of the funciton
    int nn;

    Call(....)
    .....
 	r_fm = mxGetPr(plhs[0]);
	i_fm = mxGetPi(plhs[0]);
    .....
    for (nn=0; nn < N; ++nn)
    .....

All the files listed above need to be modified like this.

Then use "system('make -f Makefile-oct')" command to build the binary file. 
After the system finish building the *.mexw32 files, copy them to the nufft/table directory, then can we run test_all_nufft successfully.


Chen DanDan

