Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error with getSpikeT #1

Open
rebecca-mease opened this issue May 13, 2022 · 2 comments
Open

error with getSpikeT #1

rebecca-mease opened this issue May 13, 2022 · 2 comments

Comments

@rebecca-mease
Copy link

Hi Jorrit, thanks for your extremely useful work on this package. I've encountered an error that pops up occasionally but it seems dependent on the state of the random number generator (and I have not yet had the time to really hunt down when it is triggered).

I did a temporary fix (below) but you likely have a better way to handle this

thanks again for this well-motivated and user-friendly package!

%Was throwing "Error using vertcat Dimensions of arrays being
%concatenated are not consistent" --not currently reproducible

%original:
%vecSpikeT = [0;sort(vecSpikeT,'ascend');dblUseMaxDur];

%RAM's fix 12.05.2022
sorted_vecSpikeT=sort(vecSpikeT,'ascend');
if size(sorted_vecSpikeT,2)>size(sorted_vecSpikeT,1)
disp 'flip it'
sorted_vecSpikeT=sorted_vecSpikeT';
end
vecSpikeT = [0;sorted_vecSpikeT;dblUseMaxDur];

@JorritMontijn
Copy link
Owner

Hi Rebecca,

Thank you for your bug report. That's very curious! On line 6 it pre-allocates vecSpikeT as vecSpikeT = nan(numel(vecSpikeTimes),1);
So it shouldn't be possible for the vector ever be larger in dimension 2 than 1, unless the number of spikes is 0, in which case vecSpikeT is [0 x 1]. But even that case, this line shouldn't throw an error. Could you let me know if you ever figure out what's happening here?

At least one way to fix it in fewer lines is changing it to:
vecSpikeT = [0;sort(vecSpikeT(:),'ascend');dblUseMaxDur];

I've changed this now, but honestly - this bug shouldn't be possbible... If anyone from the future reads this and figures it out: please let me know!

Best,
Jorrit

@rebecca-mease
Copy link
Author

Dear Jorrit, thank you! I will let you know the results when I have some time to dig into it a bit more; I agree it should not be possible. I am using 2022a and I realize now that I never encounted this problem with 2018b.

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

No branches or pull requests

2 participants