From bdea8ed613d8aed076a57685c1f356e1ba6ded58 Mon Sep 17 00:00:00 2001
From: Nicholas Alexander <nalexander@fil.ion.ucl.ac.uk>
Date: Thu, 30 Nov 2023 12:16:22 +0000
Subject: [PATCH] Switched inputs round and added exception

---
 data_functions/bidsFilename.m | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/data_functions/bidsFilename.m b/data_functions/bidsFilename.m
index 657a92c..6e301e0 100644
--- a/data_functions/bidsFilename.m
+++ b/data_functions/bidsFilename.m
@@ -1,4 +1,4 @@
-function [filename, folder] = bidsFilename(bids,cfg)
+function [filename, folder] = bidsFilename(cfg,bids)
 % Function to create a BIDS style filename. It is useful for saving and
 % loading data. Use as:
 % Usual bids info as structure containing strings:
@@ -39,7 +39,9 @@
 	cfg.description = 'folderOnly';
 	folderOnly = true;
 end
-if (~folderOnly && (~isfield(cfg,'type') || isempty(cfg.type)))
+if folderOnly
+	cfg.type = '.mat';
+elseif (~isfield(cfg,'type') || isempty(cfg.type))
 	disp('Defaulting cfg.type to .mat')
 	cfg.type = '.mat';
 end