MATLAB Answers

ZS
0

Error in attempting to access, index must be a positive integer or logical: Works on some files but not others

Asked by ZS
on 13 Aug 2018 at 4:46
Latest activity Edited by Amal George M on 16 Aug 2018 at 8:31

Hello,

I'm running a rather complicated program for data analysis that works fine for some files but not others. When I try it with a non-working file I get this answer:

    Warning: Directory already exists. 
    > In NonRephasingC16_116 at 53
    ??? Attempted to access B(135,2); index must be a positive integer or
    logical.

The "warning directory already exists" is fine, the working files do that too, it's just because I've been trying to get this to run for a while.

What it seems to be saying is that there's an error in reading my data file, but as the working and nonworking ones are identically formatted, I don't quite understand the problem. "B" is not a previously named variable, and the values separated by the comma do not appear anywhere in the data file or the program. Do these values hold some special significance in Matlab code?

Additional information:

Here is the full error message:

    Warning: Directory already exists. 
    > In NonRephasingC16_116 at 53
    ??? Attempted to access B(135,2); index must be a positive integer or
    logical.
    Error in ==> CutNRpart_RA at 21
    B(nzro,i)=0; %creates an array of nzro zeros
    Error in ==> NonRephasingC16_116 at 113
    Tcut = CutNRpart_RA([wavenumber
    reshape(tau,nCh-2,cut_tau)],pfront,nfront,nback,Ch);

I'm currently running windows 10. My computer is a HP Pavilion laptop. Matlab version is 7.11.0(R2010a) Thank you for your time!

  3 Comments

Please upload the function NonRephasingC16_116 by clicking the paperclip button.

I have done so! Hopefully the file itself explains better than I could.

Thank you very much for your response.

The error seems to originate from the call to "CutNRpart_RA()" at line 113 in "NonRephasingC16_116". Try debugging the assignment at line 21 in "CutNRpart_RA".

If you are new to Matlab, here is a link on using debugger.

Sign in to comment.

0 Answers