**Error: Subscript indices must either be real positive integers or logicals**I am a novice, following is the code and the error, could I get some help about dealing with this problem? Thank you.
A = load(strcat(pathname,filename));
% A would be a 40000*5 matrix%
ang=A(:,2);
angf=LP_filter(40,10,ang); % filter ang data to remove the jerky for easily peak detection
torq=LP_filter(40,10,A(:,3));
plot(torq);
x=ginput;
x=round(x);
dat=[];
for i=1:length(x)-1;
signal1=ang(x(i):x(i+1));
torqs=max(torq(x(i):x(i+1))); % torq limit of seg
z=zero_cross(signal1);
dd=diff(diff(signal1)); % second derivative
peak=[];
for n=1:length(z)
if (z(n) < ...

**Error ??? Subscript indices must either be real positive integers or logicals.**Hi,
I'm trying to write a program for biometric PCA:
load FaceData_56_46;
Eigenface_Training_Sample_Count = 10;
Gallery_Set_Sample_IDs = [1 2 3 4 5];
Eigenface_Dimensionality = 2116;
param_resize = 1;
Probe_Set_Sample_IDs = setdiff([1:10], Gallery_Set_Sample_IDs);
fprintf('Construct Test Data.\n');
Test_Data = [];
Class_Labels = [];
Sample_Labels = [];
for i = 1:40
for j = 1:10
I = FaceData(i,j).Image;
I = imresize(I,param_resize);
I_vector = double(reshape(I', size(I,1)*size(I,2), 1))/255; %reshape to one column
Test_Data = [Test_Data, I_vector];
...

**error : ??? Subscript indices must either be real positive integers or logicals.**I have written a function that calculates some variable "t":
function t=t_from_phi(phi, far)
i = 0;
t = exp((phi - 2.81661)/3.648659);
error = phi - phi(t, far);
while (abs(error) < 1e-06) || (i > 30)
i = i + 1;
error = phi - phi(t, far);
if(abs( error1) > 1e-06);
error2 = phi - phi((t+5), far);
t = t - error1 * 5/(error2 - error1);
end
end
end
the above function uses one more function "phi(t,far)" i.e.
function phig = phi(t,far)
phi_prod = 0.921799*log(abs(t)) + ...
((((((9.26961630e-23*t-1.1024117e-18)*...

**Subscript indices must either be real positive integers or logicals error**Hi,
I have tried the coding below and it comes up with the error "Subscript indices must either be real positive integers or logicals." I received a suggestion to use a counter however I'm unsure how to input it into my script to make it run smoothly. Any help is much appreciated.
k = 230; % Thermal conductivity (W/m^2 degrees celsius)
rho = 2700; % Density of ceramic clay (kg/m^3)
c = 910; % Specific heat coefficient (J/kg degrees celsius)
h = 300; % Convective heat transfer coefficient (W/m^2 degrees celsius)
Tinf = 20; % Temperature on the exposed surface (degrees ce...

**Subscript indices must either be real positive integers or logicals and other error.**Hi,
I want to read through both matrixes seq and seq2 but gives me two errors. Here is the code:
tr = [0.95,0.05;
0.10,0.90];
e = [1/6, 1/6, 1/6, 1/6, 1/6, 1/6;
1/10, 1/10, 1/10, 1/10, 1/10, 1/2;];
seq1 = hmmgenerate(100,tr,e);
seq2 = hmmgenerate(200,tr,e);
seqs = {seq1,seq2};
[estTR, estE] = hmmtrain(seqs,tr,e);
pStates = hmmdecode(seqs,tr,e);
Error using hmmdecode (line 96)
The sequence must be numeric, or you must specify the symbols used in the sequence.
pStates = hmmdecode(seqs(i,:),tr,e);
Subs...

**Help on Error ??? Subscript indices must either be real positive integers or logicals.**Hi, i get the above error when the code below is run. Can anyone advise?? TIA
______________________________________________________________
clear all;
clc;
p=[57.77
59.2
60.2
60.65
60.82
61.56
61.16
60.43
60.87
61.6];
p = flipud(p);
lp = log(p);
r = diff(lp);
n = length(r);
%% Sample mean
Xbar = sum(r)/n;
VR=2;
coun=1;
d=rem(n,VR);
g=n-d;
for i=1:VR:g
sum=0;
for k=i:i+VR-1
sum=sum+r(k);
end
M(coun,1)=sum;
coun=coun+1;
end
sum(M)
> sum=0;
Write 1000 times (by hand of course!):
"I will never again name a variable like an matlab function!&...

**mod/Subscript indices must either be real positive integers or logicals Error**I am continually recieving the error:
Subscript indices must either be real positive integers or logicals.
Error in "* line of code*"
Filtered(:,:,ii)=npslp(:,:,ii)-Filter(:,:,mod(i,i12));
I am trying to subtract the monthly mean from 64 years of gridded data (called H, a 34x23x768 matrix describing a X,Y, and time axis). My code is:
Filter=zeros(34,23,12);
for ii=1:12
F=zeros(34,23,768/12);
for j=1:floor((768)/12)
F(:,:,j)=H(:,:,ii+12*(j-1));
end
Filter(:,:,ii)=mean(F,3);
end
Filtered=zeros(34,23,768);
for ii=1:768;
Filtered(:,:,ii)=npslp...

**Subscript indices must either be real positive integers or logicals Error + Code**was wondering if someone can explain to me what this error means. And, if possible, how to resolve it? ??? Subscript indices must either be real positive integers or logicals.
Error in ==> interp2>linear at 344
F = ( arg3(ndx).*(onemt) + arg3(ndx+1).*t ).*(1-s) + ...
Error in ==> interp2 at 220
zi = linear(ExtrapVal,x,y,z,xi,yi);
Error in ==> snake at 71
ssx = gamma*xs - kappa*interp2(fx,xs,ys);
This is my complete code:
image = imread('image.jpg');
%parameters
alpha = 0.001;
beta = 0.4;
kappa=0.0001;
gamma = 100;
N = 100;
wl = 10;
we = 10;
wt...

**Error: Subscript indices must either be real positive integers or logicals. #2**for i = 1:sizex;
for j = 1:sizey;
cor = Xc(i,j,1);
blank( ([i j 1]*A) ) = cor;
end
end
Subscript indices must either be real positive integers or logicals.
Error in testando (line 35)
blank( ([i j 1]*A) ) = cor;
Anyone? ):
"Laryssa Seabra" <seabralaryssa@gmail.com> wrote in message <kqc670$6lr$1@newscl01ah.mathworks.com>...
> for i = 1:sizex;
> for j = 1:sizey;
> cor = Xc(i,j,1);
> blank( ([i j 1]*A) ) = cor;
> end
> end
>
>
>
>
> Subscript indi...

**MATLAB error: Subscript indices must either be real positive integers or logicals.**I am trying to enter f(t)=sqrt(t) into MATLAB, but I am getting this error: Subscript indices must be either real positive integers or logicals. How do I fix it?
Thank you very much.
On 09/22/2014 7:45 AM, Mario Guerra wrote:
> I am trying to enter f(t)=sqrt(t) into MATLAB, but I am getting this
> error: Subscript indices must be either real positive integers or
> logicals. How do I fix it?
> Thank you very much.
You've defined a variable and aliased the builtin sqrt() function.
To see what it is, now, try
which sqrt
to get back the original,
clear sqrt
...

**ERROR in Standard Deviation: Subscript indices must either be real positive integers or logicals.**Hello everybody, I get a error when I want to use Standard Deviation for my data. My data is 1024x1 double.
like this:
v=-0.3412
-0.2393
-0.0191
0.2389
0.3000
....
When I do std this error will be appear
>> std(v)
"Subscript indices must either be real positive integers or logicals."
what should I do to solve this problem?
"Babak " <b_mn@hotmail.com> wrote in message
news:kuvtvg$h2s$1@newscl01ah.mathworks.com...
> Hello everybody, I get a error when I want to use Standard Deviation for
> my data. My data is 1024x1 dou...

**"Error?Subscript indices must either be real positive integers or logicals."**Hello,
I have a 500x3 Cell array and need a 4th column that identifies which of four possible combinations exists between columns 2 and 3 on each row. I've tried to search for the combinations and allocate the appropriate output into the corresponding row of column 4. The four combinations will be coded "1" to "4". Some rows are missing data and will be arbitrarily coded "9".
The code I have written looks something like this but returns "??? Subscript indices must either be real positive integers or logicals";
A=Cellarray{i,2};
B=Cellarray...

**Subscript indices must either be real positive integers or logicals error in simple program**Hi, I've got this problem when I get the following error:
??? Subscript indices must either be real positive integers or logicals.
Error in ==> taborttrend at 7
diff(X,1)
My program is very easy and looks like this:
function taborttrend(x,diff)
V=load(x);
V_mod1=diff(V,1);
Why do I get this error and what must I do to fix it. x is just a loaded .txt file on the form:
7.04
7.50
7.29
6.69
6.65
6.14
4.39
6.72
6.45
Please help my!
/E
> function taborttrend(x,diff) <- Do not name a variable (diff) as Matlab stock functions
> V=load(x);
> V_mod1=diff(V,1); <- Which is...

**Subscript indices must either be real positive integers or logicals error on different machines**Hi,
I seem to be getting the following error:
Error in ==>
\\vasuki\public\products\TaxAwareSimulator\dev\MatlabCode\US\HIFO.m
On line 62 ==> tempLTLoc = find(inCounter -
inPurchaseDate(tempPriceRef(tempNegLoc) >= 12 &
inPurchaseDate(tempPriceRef(tempNegLoc)
tempNegLoc are indicies as is tempPriceRef. inPurchaseDate is a
301X500 matrix and inCounter is a 1x1 scalar.
When I run the same code on two other machines, I don't get this
error and the application runs until completion.
Zeshan Azam wrote:
>
>
> Hi,
>
> I seem to be getting the following error:
>
...

**Subscript indices must either be real positive integers or logicals. Error in ==> interp2 at 208**Hello,
I am trying to interpolate missing data in the matrix X x Y using:
X=[20 24 28 35 47 54];
Y=[47 58 27 71 14 66];
[XI,YI] = meshgrid(X,Y);
Z=[78.24 70.03 78.93 81.73 78.71 77.17];
ZI=interp2(X,Y,Z,XI,YI);
But, I got this error: ??? Subscript indices must either be real positive integers or logicals.
Error in ==> interp2 at 208
vi = vi + (yi(:)-yy(vi))./(yy(vi+1)-yy(vi));
Error in ==> interpolation at 11
ZI=interp2(X,Y,Z,XI,YI);
Any suggestion how to fix this? or why I getting this error?
Thanks,
Ruben
On 7/28/2011 10:19 AM, Ruben Llamas wro...

**Subscript indices must either be real positive integers or logicals error in simple array program**Hi I'm a graduate student and studying Matlab.
I have a difficulty in solving this problem.
"data" is a matrix.
My problem is below,
for i=data(1,:):length(data)
[s, r, t] = pcapro(data(i,1:12), modl, 0)
end
"Subscript indices must either be real positive integers or logicals." this message comes up..
I don't know how to solve it.. please help me..
Yoontae $=C3=9C wrote:
> "data" is a matrix.
> My problem is below,
>=20
> for i=3Ddata(1,:):length(data)
I'd have to think for a while about what that means to Ma...

**Subscript indices must either be real positive integers or logicals error in simple array program #2**Hi this is the code that i am using and am having difficulty in finding the error
D = 5.2.*exp(-6);
x = 80 * 10 ^(-3) ;
for t = 1:1:60
C(x,t) = erfc(x./2.*sqrt(D.*t));
end
plot(t,C);
And the error is
??? Subscript indices must either be real positive integers or logicals.
Error in ==> hw5_1 at 10
C(x1,t) = erfc(x1./2.*sqrt(D.*t));
please reply fast
D = 5.2.*exp(-6);
x = 80 * 10 ^(-3) ;
t = 1:1:60;
C = erfc(x/2*sqrt(D*t));
plot(t,C);
You should 'Getting Started' in the Matlab Help
Shaun
To answer your question, you are trying to assign a value to the element ...

**it shows an error saying indices must be either real positive integers or logical, the error is pointing at " del = D**while(Del>0) % Test for convergence
r=r+1;
for k= 1:3 % no. of iterations
P = (lambda - beta)./(2*gamma);
end
if(r~=1)&&(r<6)
for iter = 1:3
if(P(iter)< mwlimits(iter,1))
P(iter)=mwlimits(iter,1);
x(iter)=0;
elseif(P(iter)> mwlimits(iter,2))
P(iter)=mwlimits(iter,2);
x(iter)=0;
end
end
end
J = 0.5*((x(1)/gamma(1...

**Subscript indices must either be real positive integers or logicals??**clear
clc
n=input('The point:-');
l=input('The lenght:-');
m=(l/((n/8)-1));
x=zeros(n);
y=zeros(n);
for i=0:(n/8);
x(i)=2
y(i)=l*tan(i*2*pi/n);
end
for i=((n/8)+m):(3*n/8);
y(i)=2
x(i)=l/tan(i*2*pi/n);
end
for i=((3*n/8)+m):(5*n/8);
x(i)=-2
y(i)=l*tan(i*2*pi/n);
end
for i=((5*n/8)+m):(7*n/8);
y(i)=-2
x(i)=l*tan(i*2*pi/n);
end
for i=((7*n/8)+m):(n/8);
x(i)=2
y(i)=l*tan(i*2*pi/n);
end
---------------------------------
The point:-32
The lenght:-2
??? Subscript indices must either be real positive integers or logicals.
Error in ==> C:\MAT...

**??? Subscript indices must either be real positive integers or logicals.**Greetings,
I have the following error:
??? Subscript indices must either be real positive integers or
logicals.
in the following code:
clf
rand('state',100)
%stoichiometric matrix
V = [-1 1 0; -1 1 1; 1 -1 -1; 0 0 1];
%%%%%%%%%% Parameters and Initial Conditions %%%%%%%%%
nA = 6.023e23; % Avagadro's number
vol = 1e-15; % volume of system
X = zeros(4,1);
X(1) = round(5e-7*nA*vol); % molecules of substrate
X(2) = round(2e-7*nA*vol); % molecules of enzyme
c(1) = 1e6/(nA*vol); c(2) = 1e-4; c(3) = 0.1;
t = 0;
tfinal = 50;
count = 1;
tvals(1) = 0;
Xvals...

**Subscript indices must either be real positive integers or logicals**Hi,
I have created a code which works fine for i=1, i=2, i=3 etc but if I have it done in a loop (e.g. for i=1:3) there is an error message saying "Subscript indices must either be real positive integers or logicals"
for i=1
<code> ---->works
end
for i=2
<code> ----> works
end
for i=1:2
<code> ----> DOESN'T work!!!! WHY?!?
end
The error message comes at a function call inside the code, which features a double sum of elements of a M x M matrix. Any clues on what I should try out?
PS: The code is kinda big so I 'll send...

**??? Subscript indices must either be real positive integers or logicals.**the line causing the error in my code is
a(j,i)=((1/(h^(2)))+(1/(2*(h^(2))))*(y(j,i+1)-y(j,i-1)));
i don't know where lies the error.
Please help.
Thanks in advance.
"Shruti Mohanta" <ssmohanta@gmail.com> wrote in message <i5sqtc$51t$1@fred.mathworks.com>...
> the line causing the error in my code is
>
> a(j,i)=((1/(h^(2)))+(1/(2*(h^(2))))*(y(j,i+1)-y(j,i-1)));
> i don't know where lies the error.
> Please help.
> Thanks in advance.
Hi
most likely you have j less than 1 or i less than 2. either of those would be ill...

**Subscript indices must either be real positive integers or logicals.???**I'm trying to make a series of loops run that are analyzing a surface and I get this error when I attempt to run:
Subscript indices must either be real positive integers or logicals.
I feel I've debuged everything as best I can ... but can't seem to figure out what this means. I've already defined all my variables in the loop. What I'm attempting to do is to set a threshold value of a surface (DELTA), and then count the peaks above that threshold - everything below it I set to 0 earlier. From there, I am using a formula to find the radius of curvature. Here is my loop...

**Subscript indices must either be real positive integers or logicals.**When i try to run the following script i get the error: Subscript indices must either be real positive integers or logicals. I would like to use the values that Z1 and Z2 gives to see which one is the smallest. It are all values like this: 0.099910704012179.
I hope someone can help me find the bug here.
Script:
%filename: FlutaPan.m
[X,Y] = meshgrid(0:0.1:1,1:-0.1:0);
for i =1:11
for j =1:11
Z1(j,i) = Flutami1(X(1,i),Y(j,1));
Z2(j,i) = PanVac2(X(1,i),Y(j,1));
besteKeuze = Keuze(Z1, Z2)
end
end
contourf(X,Y,Z1,10)
colorbar
xlabel('Beta','FontSize',14)
ylabel...