HELP! Can't run script
2 views (last 30 days)
Show older comments
Hello, I generated this code from the SPM gui, but it can't seem to run in matlab command. I also need to generate a for-loop for this code. Can anyone tell me what's the issue?
subject = [PETER404 PETER405]';
user = getenv(' user ') ; %
for subject=subjects
subject = num2str(subject, '%02d')
matlabbatch{1}.spm.spatial.realignunwarp.data.scans = {
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104645-00226-00326-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104646-00227-00327-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104647-00228-00328-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104648-00229-00329-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104649-00230-00230-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104301-00002-00002-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104302-00003-00003-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104303-00004-00004-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104304-00005-00005-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104305-00006-00006-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104306-00007-00007-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104307-00008-00008-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104308-00009-00009-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104309-00010-00010-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104310-00011-00011-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104311-00012-00012-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104312-00013-00013-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104313-00014-00014-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104314-00015-00015-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104315-00016-00016-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104316-00017-00017-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104317-00018-00018-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104318-00019-00019-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104319-00020-00020-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104320-00021-00021-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104321-00022-00022-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104322-00023-00023-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104323-00024-00024-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104324-00025-00025-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104325-00026-00026-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104326-00027-00027-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104327-00028-00028-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104328-00029-00029-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104329-00030-00030-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104330-00031-00031-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104331-00032-00032-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104332-00033-00033-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104333-00034-00034-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104334-00035-00035-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104335-00036-00036-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104336-00037-00037-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104337-00038-00038-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104338-00039-00039-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104339-00040-00040-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104340-00041-00041-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104341-00042-00042-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104342-00043-00043-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104343-00044-00044-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104344-00045-00045-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104345-00046-00046-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104346-00047-00047-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104347-00048-00048-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104348-00049-00049-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104349-00050-00050-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104350-00051-00051-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104351-00052-00052-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104352-00053-00053-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104353-00054-00054-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104354-00055-00055-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104355-00056-00056-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104356-00057-00057-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104357-00058-00058-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104358-00059-00059-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104359-00060-00060-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104400-00061-00061-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104401-00062-00062-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104402-00063-00063-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104403-00064-00064-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104404-00065-00065-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104405-00066-00066-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104406-00067-00067-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104407-00068-00068-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104408-00069-00069-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104409-00070-00070-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104410-00071-00071-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104411-00072-00072-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104412-00073-00073-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104413-00074-00074-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104414-00075-00075-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104415-00076-00076-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104416-00077-00077-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104417-00078-00078-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104418-00079-00079-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104419-00080-00080-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104420-00081-00081-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104421-00082-00082-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104422-00083-00083-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104423-00084-00084-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104424-00085-00085-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104425-00086-00086-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104426-00087-00087-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104427-00088-00088-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104428-00089-00089-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104429-00090-00090-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104430-00091-00091-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104431-00092-00092-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104432-00093-00093-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104433-00094-00094-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104434-00095-00095-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104435-00096-00096-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104436-00097-00097-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104437-00098-00098-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104438-00099-00099-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104439-00100-00100-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104440-00101-00101-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104441-00102-00102-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104442-00103-00103-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104443-00104-00104-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104444-00105-00105-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104445-00106-00106-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104446-00107-00107-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104447-00108-00108-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104448-00109-00109-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104449-00110-00110-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104450-00111-00111-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104451-00112-00112-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104452-00113-00113-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104453-00114-00114-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104454-00115-00115-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104455-00116-00116-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104456-00117-00117-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104457-00118-00118-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104458-00119-00119-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104459-00120-00120-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104500-00121-00121-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104501-00122-00122-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104502-00123-00123-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104503-00124-00124-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104504-00125-00125-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104505-00126-00126-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104506-00127-00127-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104507-00128-00128-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104508-00129-00129-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104509-00130-00130-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104510-00131-00131-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104511-00132-00132-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104512-00133-00133-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104513-00134-00134-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104514-00135-00135-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104515-00136-00136-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104516-00137-00137-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104517-00138-00138-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104518-00139-00139-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104519-00140-00140-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104520-00141-00141-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104521-00142-00142-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104522-00143-00143-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104523-00144-00144-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104524-00145-00145-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104525-00146-00146-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104526-00147-00147-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104527-00148-00148-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104528-00149-00149-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104529-00150-00150-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104530-00151-00151-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104531-00152-00152-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104532-00153-00153-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104533-00154-00154-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104534-00155-00155-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104535-00156-00156-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104536-00157-00157-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104537-00158-00158-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104538-00159-00159-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104539-00160-00160-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104540-00161-00161-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104541-00162-00162-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104542-00163-00163-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104543-00164-00164-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104544-00165-00165-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104545-00166-00166-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104546-00167-00167-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104547-00168-00168-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104548-00169-00169-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104549-00170-00170-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104550-00171-00171-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104551-00172-00172-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104552-00173-00173-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104553-00174-00174-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104554-00175-00175-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104555-00176-00176-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104556-00177-00177-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104557-00178-00178-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104558-00179-00179-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104559-00180-00180-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104600-00181-00181-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104601-00182-00182-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104602-00183-00183-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104603-00184-00184-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104604-00185-00185-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104605-00186-00186-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104606-00187-00187-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104607-00188-00188-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104608-00189-00189-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104609-00190-00190-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104610-00191-00191-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104611-00192-00192-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104612-00193-00193-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104613-00194-00194-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104614-00195-00195-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104615-00196-00196-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104616-00197-00197-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104617-00198-00198-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104618-00199-00199-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104619-00200-00200-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104620-00201-00201-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104621-00202-00202-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104622-00203-00203-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104623-00204-00204-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104624-00205-00205-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104625-00206-00206-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104626-00207-00207-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104627-00208-00208-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104628-00209-00209-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104629-00210-00210-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104630-00211-00211-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104631-00212-00212-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104632-00213-00213-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104633-00214-00214-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104634-00215-00215-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104635-00216-00216-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104636-00217-00217-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104637-00218-00218-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104638-00219-00219-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104639-00220-00220-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104640-00221-00221-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104641-00222-00222-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104642-00223-00223-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104643-00224-00224-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104644-00225-00225-1.nii,1']
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104300-00001-00001-1.nii,1']
};
%%
matlabbatch{1}.spm.spatial.realignunwarp.data.pmscan = {['/Users/' user '/Documents/MATLAB/vdm5_scs' subject '-0008-00001-000001-01.nii,1']};
matlabbatch{1}.spm.spatial.realignunwarp.eoptions.quality = 0.9;
matlabbatch{1}.spm.spatial.realignunwarp.eoptions.sep = 4;
matlabbatch{1}.spm.spatial.realignunwarp.eoptions.fwhm = 5;
matlabbatch{1}.spm.spatial.realignunwarp.eoptions.rtm = 0;
matlabbatch{1}.spm.spatial.realignunwarp.eoptions.einterp = 2;
matlabbatch{1}.spm.spatial.realignunwarp.eoptions.ewrap = [0 0 0];
matlabbatch{1}.spm.spatial.realignunwarp.eoptions.weight = '';
matlabbatch{1}.spm.spatial.realignunwarp.uweoptions.basfcn = [12 12];
matlabbatch{1}.spm.spatial.realignunwarp.uweoptions.regorder = 1;
matlabbatch{1}.spm.spatial.realignunwarp.uweoptions.lambda = 100000;
matlabbatch{1}.spm.spatial.realignunwarp.uweoptions.jm = 0;
matlabbatch{1}.spm.spatial.realignunwarp.uweoptions.fot = [4 5];
matlabbatch{1}.spm.spatial.realignunwarp.uweoptions.sot = [];
matlabbatch{1}.spm.spatial.realignunwarp.uweoptions.uwfwhm = 4;
matlabbatch{1}.spm.spatial.realignunwarp.uweoptions.rem = 1;
matlabbatch{1}.spm.spatial.realignunwarp.uweoptions.noi = 5;
matlabbatch{1}.spm.spatial.realignunwarp.uweoptions.expround = 'Average';
matlabbatch{1}.spm.spatial.realignunwarp.uwroptions.uwwhich = [2 1];
matlabbatch{1}.spm.spatial.realignunwarp.uwroptions.rinterp = 4;
matlabbatch{1}.spm.spatial.realignunwarp.uwroptions.wrap = [0 0 0];
matlabbatch{1}.spm.spatial.realignunwarp.uwroptions.mask = 1;
matlabbatch{1}.spm.spatial.realignunwarp.uwroptions.prefix = 'u';
matlabbatch{2}.spm.spatial.coreg.estwrite.ref = {['/Users/' user '/Documents/MATLAB/vdm5_scs' subject '-0008-00001-000001-01.nii,1']};
matlabbatch{2}.spm.spatial.coreg.estwrite.source(1) = cfg_dep('Realign & Unwarp: Unwarped Mean Image', substruct('.','val', '{}',{1}, '.','val', '{}',{1}, '.','val', '{}',{1}), substruct('.','meanuwr'));
matlabbatch{2}.spm.spatial.coreg.estwrite.other(1) = cfg_dep('Realign & Unwarp: Unwarped Images (Sess 1)', substruct('.','val', '{}',{1}, '.','val', '{}',{1}, '.','val', '{}',{1}), substruct('.','sess', '()',{1}, '.','uwrfiles'));
matlabbatch{2}.spm.spatial.coreg.estwrite.eoptions.cost_fun = 'nmi';
matlabbatch{2}.spm.spatial.coreg.estwrite.eoptions.sep = [4 2];
matlabbatch{2}.spm.spatial.coreg.estwrite.eoptions.tol = [0.02 0.02 0.02 0.001 0.001 0.001 0.01 0.01 0.01 0.001 0.001 0.001];
matlabbatch{2}.spm.spatial.coreg.estwrite.eoptions.fwhm = [7 7];
matlabbatch{2}.spm.spatial.coreg.estwrite.roptions.interp = 4;
matlabbatch{2}.spm.spatial.coreg.estwrite.roptions.wrap = [0 0 0];
matlabbatch{2}.spm.spatial.coreg.estwrite.roptions.mask = 0;
matlabbatch{2}.spm.spatial.coreg.estwrite.roptions.prefix = 'r';
matlabbatch{3}.spm.spatial.preproc.channel.vols = {['/Users/' user '/Documents/MATLAB/Images/F' subject '/s' subject '-0006-00001-000176-01.nii,1']};
matlabbatch{3}.spm.spatial.preproc.channel.biasreg = 0.001;
matlabbatch{3}.spm.spatial.preproc.channel.biasfwhm = 60;
matlabbatch{3}.spm.spatial.preproc.channel.write = [0 0];
matlabbatch{3}.spm.spatial.preproc.tissue(1).tpm = {['/Users/' user '/Downloads/spm12/tpm/TPM.nii,1']};
matlabbatch{3}.spm.spatial.preproc.tissue(1).ngaus = 1;
matlabbatch{3}.spm.spatial.preproc.tissue(1).native = [0 0];
matlabbatch{3}.spm.spatial.preproc.tissue(1).warped = [0 0];
matlabbatch{3}.spm.spatial.preproc.tissue(2).tpm = {['/Users/' user '/Downloads/spm12/tpm/TPM.nii,2']};
matlabbatch{3}.spm.spatial.preproc.tissue(2).ngaus = 1;
matlabbatch{3}.spm.spatial.preproc.tissue(2).native = [0 0];
matlabbatch{3}.spm.spatial.preproc.tissue(2).warped = [0 0];
matlabbatch{3}.spm.spatial.preproc.tissue(3).tpm = {['/Users/' user '/Downloads/spm12/tpm/TPM.nii,3']};
matlabbatch{3}.spm.spatial.preproc.tissue(3).ngaus = 2;
matlabbatch{3}.spm.spatial.preproc.tissue(3).native = [0 0];
matlabbatch{3}.spm.spatial.preproc.tissue(3).warped = [0 0];
matlabbatch{3}.spm.spatial.preproc.tissue(4).tpm = {['/Users/' user '/Downloads/spm12/tpm/TPM.nii,4']};
matlabbatch{3}.spm.spatial.preproc.tissue(4).ngaus = 3;
matlabbatch{3}.spm.spatial.preproc.tissue(4).native = [0 0];
matlabbatch{3}.spm.spatial.preproc.tissue(4).warped = [0 0];
matlabbatch{3}.spm.spatial.preproc.tissue(5).tpm = {['/Users/' user '/Downloads/spm12/tpm/TPM.nii,5']};
matlabbatch{3}.spm.spatial.preproc.tissue(5).ngaus = 4;
matlabbatch{3}.spm.spatial.preproc.tissue(5).native = [0 0];
matlabbatch{3}.spm.spatial.preproc.tissue(5).warped = [0 0];
matlabbatch{3}.spm.spatial.preproc.tissue(6).tpm = {['/Users/' user '/Downloads/spm12/tpm/TPM.nii,6']};
matlabbatch{3}.spm.spatial.preproc.tissue(6).ngaus = 2;
matlabbatch{3}.spm.spatial.preproc.tissue(6).native = [0 0];
matlabbatch{3}.spm.spatial.preproc.tissue(6).warped = [0 0];
matlabbatch{3}.spm.spatial.preproc.warp.mrf = 1;
matlabbatch{3}.spm.spatial.preproc.warp.cleanup = 1;
matlabbatch{3}.spm.spatial.preproc.warp.reg = [0 0.001 0.5 0.05 0.2];
matlabbatch{3}.spm.spatial.preproc.warp.affreg = 'mni';
matlabbatch{3}.spm.spatial.preproc.warp.fwhm = 0;
matlabbatch{3}.spm.spatial.preproc.warp.samp = 3;
matlabbatch{3}.spm.spatial.preproc.warp.write = [1 1];
matlabbatch{3}.spm.spatial.preproc.warp.vox = NaN;
matlabbatch{3}.spm.spatial.preproc.warp.bb = [NaN NaN NaN
NaN NaN NaN];
matlabbatch{4}.spm.spatial.normalise.write.subj.def(1) = cfg_dep('Segment: Forward Deformations', substruct('.','val', '{}',{3}, '.','val', '{}',{1}, '.','val', '{}',{1}), substruct('.','fordef', '()',{':'}));
matlabbatch{4}.spm.spatial.normalise.write.subj.resample(1) = cfg_dep('Coregister: Estimate & Reslice: Coregistered Images', substruct('.','val', '{}',{2}, '.','val', '{}',{1}, '.','val', '{}',{1}, '.','val', '{}',{1}), substruct('.','cfiles'));
matlabbatch{4}.spm.spatial.normalise.write.woptions.bb = [-78 -112 -70
78 76 85];
matlabbatch{4}.spm.spatial.normalise.write.woptions.vox = [2 2 2];
matlabbatch{4}.spm.spatial.normalise.write.woptions.interp = 4;
matlabbatch{4}.spm.spatial.normalise.write.woptions.prefix = 'w';
matlabbatch{5}.spm.spatial.smooth.data(1) = cfg_dep('Normalise: Write: Normalised Images (Subj 1)', substruct('.','val', '{}',{4}, '.','val', '{}',{1}, '.','val', '{}',{1}, '.','val', '{}',{1}), substruct('()',{1}, '.','files'));
matlabbatch{5}.spm.spatial.smooth.fwhm = [8 8 8];
matlabbatch{5}.spm.spatial.smooth.dtype = 0;
matlabbatch{5}.spm.spatial.smooth.im = 0;
matlabbatch{5}.spm.spatial.smooth.prefix = 's';
3 Comments
Walter Roberson
on 28 Jan 2021
['Users/' user '/Documents/MATLAB/Images/F' subject '/f' subject '-104645-00226-00326-1.nii,1']
Those should all be /Users not Users
You should not be doing all those string concatenations.You should be assigning
if ispc()
userdir = [getenv('HOMEDRIVE'} getenv('HOMEPATH')];
else
userdir = getenv('HOME');
end
DLDIR = fullfile(userdir, 'Downloads');
MATDIR = fullfile(userdir, 'Documents', 'MATLAB');
IMGDIR = fullfile(MATDIR, 'IMAGES');
and
fullfile(IMGDIR, ['F' subject], ['f' subject '-104645-00226-00326-1.nii,1'])
and so on.
Answers (1)
Gaurav Garg
on 28 Jan 2021
Hi Ashley,
The first problem I can see in your code is the use of 'for' loop.
1 Comment
Walter Roberson
on 31 Jan 2021
Considering their code, the main thing to watch out for is that they have
subject = [PETER404 PETER405]';
for subject=subjects
in a context in which they expect each subject to be numeric scalar. When you [] two numeric scalars like that, you get a row vector of numeric scalars, and when you ' a row vector, you get a column vector, so subjects would be a column vector. However, for iterates over columns not over rows, so the for would execute once with subject set to the column containing [PETER404; PETER405] which is not what is desired. The fix would be
subject = [PETER404 PETER405];
without the transpose.
Most people would not notice this in the documentation for for the first dozen times they read the documentation, so just pointing them vaguely at the documentation would not be enough: if you are trying to point out that difference between rows and columns for the purpose of for it is best to mention it explicitly.
See Also
Categories
Find more on Biomedical Imaging in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!