Index exceeds matrix dimensions.
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi,
I have 4D data in a Nifti file format. My code looks like this:
vals = importdata('/Users/values.txt')
data = load_untouch_nii('/Users/Niftidata.nii');
data = bsxfun(@rdivide, data, data(:,:,:,find(vals==0)));
When I run those lines I get the following error but I don't understand why: Index exceeds matrix dimensions.
0 commentaires
Réponses (1)
Guillaume
le 28 Nov 2018
"When I run those lines I get the following error but I don't understand why"
That would be because find(vals==0) returns one (or more) index that is greater than size(data, 4). There is nothing in your code that guarantees that it is not the case. As written, it is an implicit assumption of your code that the zeros of values.txt are at indices smaller than the size of that 4th dimension in your nifti file. Obviously, for the two files you're using, this is not the case. There's nothing we can do about that. Either use files where the implicit assumption is true or change what you are doing with these files.
0 commentaires
Voir également
Catégories
En savoir plus sur Audio and Video Data dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!