function interactiveToBatch()
% interactive to batch

%% for loop
A = cell(1,4);
for(i=1:4)
A{i} = magic(i);
end
A{:}

%% interactive parallel for loop
A = cell(1,4);
parfor(i=1:4)
A{i} = magic(i);
end
A{:}

%% batch job
jm = findResource('scheduler', 'configuration', 'local');
job = createJob(jm);
for(i=1:4)
    createTask(job, @magic, 1, {i});
end
submit(job);
waitForState(job);
A = getAllOutputArguments(job);
A{:}
end