Skip to content

Update ProcessDirs.m#40

Open
yjevelyn wants to merge 4 commits intochengtang827:masterfrom
yjevelyn:dpv
Open

Update ProcessDirs.m#40
yjevelyn wants to merge 4 commits intochengtang827:masterfrom
yjevelyn:dpv

Conversation

@yjevelyn
Copy link

No description provided.

@grero
Copy link
Collaborator

grero commented May 28, 2025

Hm, I think I need a bit more explanation for this one. Why end-14?

@yjevelyn
Copy link
Author

The cd() function was throwing an error whenever we tried to run the script because the path we were giving it leads directly to a spiketrain.mat object, not the directory that object is located in. To resolve the issue, I very quickly added a couple of lines that would truncate "spiketrain.mat" from the path string (14 chars). So, for example instead of:

/20180220/session01/array01/channel020/cell01/spiketrain.mat

the cd() function would receive...

/20180220/session01/array01/channel020/cell01/

This resolved the issue.

The truncation is currently hard coded into the script (it was the fastest way for us to fix the problem so we could move on). It would break if we happened to change the name "spiketrain.mat" to anything of a different length. If you want, I can add some flexibility.

-Bell

@grero
Copy link
Collaborator

grero commented May 28, 2025

Hm, I see. I think in general the input to ProcessDirs is assumed to be directories, not files. It's a good idea to check that, though, but I think a more general solution would be to first use the isfile function to check if dirs{i} is a file, then use the fileparts function to chop of the filename, leaving only the folder name.

@yjevelyn
Copy link
Author

Yeah, can do. Give me a bit.

@yjevelyn
Copy link
Author

Hm, I see. I think in general the input to ProcessDirs is assumed to be directories, not files. It's a good idea to check that, though, but I think a more general solution would be to first use the isfile function to check if dirs{i} is a file, then use the fileparts function to chop of the filename, leaving only the folder name.

So, the input to ProcessDirs depends on whatever's in your mysessions.txt file, which depends on whatever's in your mycells.txt file. mycells.txt contains paths to spiketrain.mats, whereas mysessions.txt contains paths to directories. Wondering if perhaps we accidentally passed the wrong .txt file to ProcessDirs. To be honest, that may have been the issue.

Do you still want me to implement the changes?

@grero
Copy link
Collaborator

grero commented May 28, 2025

Yes, I think it would be good to have these changes implemented, as otherwise you'd have to manually strip off the file name before passing the list to ProcessDirs.

@yjevelyn
Copy link
Author

If you just pass ProcessDirs the right file (I believe we may have passed it mycells.txt instead of mysessions.txt) I don't think it'll ever be an issue. mysessions.txt contains the right path names. We can implement a failsafe, though...

@grero
Copy link
Collaborator

grero commented May 28, 2025

OK, we can leave this pull request for now if you found a solution that works for you : )

@yjevelyn
Copy link
Author

Coooool. Okay, I think the four of us are ready for more instruction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants