Closed stevevanhooser closed 3 years ago
@Sophie-Greer
So, I'm looking at +ndr/+format/+spikegadgets/read_rec_config.m
this changes the filename to be read from 'tmpheaderfile.xml' to 'Y.xml'. There are a few issues.
First, I think you want to generate a filename that is a random string of digits.
X = randi(10) produces a single random integer between 1 and 10. Let's make it a random number between 1 and 100000 so there are more possibilities.
Y = int2str(X)
This makes a string Y from the digits in X. But here
fid = fopen('Y.xml','w');
sets the filename to literally 'Y.xml'. I think what you mean is [Y '.xml'] instead of 'Y.xml'. [Y '.xml'] is the concatenation of the string in variable Y with '.xml'.
The other thing that is missing is that the file is still written to the current directory, wherever the user happens to be.
It would be better on line 42 to add
ndr.globals
X = randi(100000); Y = int2str(X); filename = [ndr_globals.path.testpath filesep Y '.xml'];
and then use the variable filename for all the times you read in the filename.
Make sense?
Yes, that does make sense, thank you for explaining. I have made those changes on +ndr.+format.+spikegadgets.read_rec_config.m.
thanks. It had an error in it; filename was defined in terms of Y before Y was defined. I fixed that, so now the issue is closed.
The current spikegadgets reader puts a temporary xml file in the current directory, whereever that happens to be.
A better solution would be to have it make a new temporary file in
ndr_globals.path.temppath
Rewrite lines 43-58 so it writes it to a file with some randomness in its name in the temporary path. You can use the function randi to generate some random integers and int2str to convert them to a string for the filename.
You'll need to call
ndr.globals
in order to be able to accessndr_globals.path.temppath