I am quite new to matlab/programming in general and am trying to learn how to use the package "OMP Analysis" from geomar to figure out source water masses (https://www.mathworks.com/matlabcentral/fileexchange/1334-omp-analysis). So far I've only tried running the test data provided in the package. I select the "interactive(listing)" option, select extended water mass analysis, then don't change anything else. Everything works fine until I get to the final prompt, "Do you want to see more graphic output?". I input "y" and get the following error message:
Index exceeds matrix dimensions.
Error in contour2 (line 27)
para=A(st,:);
Error in omp2 (line 272)
contour2
Error in omp2int (line 454)
omp2
Error while evaluating DestroyedObject Callback.
From what I can tell the error is originating in that one line from contour2 and then messing up subsequent commands. The dimension of A is a 2x204 double and the dimension of st is a 204x1 double.
Any help in figuring out this problem would be greatly appreciated!
Related
I am trying to run a repeated measures ANOVA in Matlab with 4 factors including one factor representing my subjects which I want as a random factor.
The code I have is as follows:
[p,table,stats] = anovan(COORDS_SUBJ_II,{group_hand,group_stim,group_time,group_subs},'random',4,'varnames',{'HAND','STIM','TIME','SUBS'});
Here, all variables have the same dimension, which is 1350x1(all types are 'double'). I checked my code with some proposed code on the net and it matches, yet I keep getting the following error...
Error using chi2inv (line 3)
P and V must be of common size or scalars
Error in anovan>varcompest (line 838)
L = msTerm .* dfTerm ./ chi2inv(1-alpha/2,dfTerm);
Error in anovan>getRandomInfo (line 811)
[varest,varci] = varcompest(ems,randomterms,msTerm,dfTerm,alpha);
Error in anovan (line 296)
getRandomInfo(msterm,dfterm,mse,dfe,emsMat,randomterm,...
My dependent variable (COORDS_SUBJ_II) has a couple of NaN's in it, although I ran the code once where I replaced those NaN's with random numbers and it still gives me the same error. I am kind of lost right now and would appreciate any help.
Best
ty
Found it out. A toolbox I downloaded a while ago also had the chi2inv command and this prompted the error =)
Hi I'm trying to fit a power model to my data using MatLab's fit function
fo = fit(log2(x(:)),log2(y(:)),'power1');
plot(fo,'g'), hold on
However when I run this I get the error
Error using fit>iFit (line 282)
Cannot fit Power functions to data where X has nonpositive values.
Error in fit (line 108)
[fitobj, goodness, output, convmsg] = iFit( xdatain, ydatain, fittypeobj, ...
Error in CurvedPowerLaw (line 20)
fo = fit(log2(x(:)),log2(y(:)),'power1');
When looking at my data and checking if any are less than 1, nothing is displayed
x(count_1)=M(i,1);
y(count_1)=M(i,2);
count_1= count_1+1;
if(M(i,2)<1)
display(M(i,1))
end;
M is a csv file with two columns. I also re ran the code for
if(M(i,1)<1)
and nothing was displayed. Checking manually and nothing seemed to be below 1 either.
i is just the line in the file that is being parsed. The file looks like
344,17
345,13
346,13
347,16
340,12
M(i,1) will result in returning one of the >300 numbers and M(i,2) will return ~10 value
Any help would be much appreciated!!
Thanks
While all values that were parsed in were >0 when scaling them by log2 that's where the 0 values started appearing. A quick fix was to add 1 to each value when parsing them in.
I am a novice when it comes to the topic of Structure From Motion. I have been trying to follow the tutorial here in the MathWorks webpage for SFM: LINK.
However, after running the code, I get this error message:
Warning: Maximum number of trials reached. Consider increasing the maximum
distance or decreasing the desired confidence.
> In vision.internal.ransac.msac (line 136)
In estimateEssentialMatrix (line 161)
In helperEstimateRelativePose (line 43)
In PERFORM_SFM (line 70)
Error using helperEstimateRelativePose (line 70)
Unable to compute the Essential matrix
Error in PERFORM_SFM (line 70)
[relativeOrient, relativeLoc, inlierIdx] = helperEstimateRelativePose(...
Could someone help me understand why this is happening? Could someone provide me an different approach?
I just managed to solve this same error. In my case, it seems I was using too many images, so the resulting equation system was overdetermined and, therefore, the matrix could not be computed. I just tested with a number of images similar to the example (6, in my case) and enough camera movement from frame to frame, and it works like it should.
Hope this helps.
As #Ander Biguri said, consider increasing the maximum distance or decreasing the desired confidence. You can do this by modifying the Matlab built-in function helperEstimateRelativePose.m: line 43. Then you can add as many images as you want. After modification, it should look like this:
[E, inlierIdx] = estimateEssentialMatrix(matchedPoints1, matchedPoints2,...
cameraParams, 'Confidence', 50, 'MaxDistance', 5);
But be careful editing the built-in functions. In my case, I modified the function and saved into another folder by another name and add that folder into path.
I hope this will help someone.
I was trying to run the skeletonization and skeleton pruning software from
skeletonization and skeleton pruning
and getting the following errors. I used matlab 2015a .Authors claimed that it runs on matlab 7.0. Please help me to correct it.i just want to see the output. Anyone can suggest a pseudocode for Skeletonization and Skeleton Pruning in simple way?
Error in SkeletonGrow1 (line 42)
skltn(i,j) = CheckSkeleton1(bw,dist,lab,i,j,ro,mark);
Error in div_skeleton_new (line 51)
bw=SkeletonGrow1(I0,ro,mark);
Error in Test (line 6)
[bw,I0,x,y,x1,y1,aa,bb]=div_skeleton_new(4,1,bw,15);
first two errors are due to same function (CheckSkeleton1). The number of arguments are different in both calls. Tweek it, do check readme file or contact author.
I am working on a project that needs to use hidden markov models. I downloaded Kevin Murphy's toolbox. I have some problems about the usage. In the toolbox webpage, he says that first input of dhmm_em and dhmm_logprob are symbol sequence data. On their examples, they give row vectors as data. So, when I give my symbol sequence as row vector, I get error;
??? Error using ==> assert at 9
assertion violated:
Error in ==> fwdback at 105
assert(approxeq(sum(alpha(:,t)),1))
Error in ==> dhmm_logprob at 17
[alpha, beta, gamma, ll] = fwdback(prior,
transmat, obslik, 'fwd_only', 1);
Error in ==> mainCourseProject at 110
loglik(train_act) =
dhmm_logprob(orderedSymbols,
hmm{train_act}.prior,
hmm{train_act}.trans,
hmm{act}.emiss);
However, before giving this error, code works for some symbol vectors. When I give my data as column vector, functions work fine, no errors. So why exactly am I getting this error?
You might say that I should be giving not single vectors, but vector sets, I also tried to collect my feature vectors in a struct and give row vectors as such, but nothing changed, I still get assertion error.
By the way, my symbol sequence does not have any zeros, I am doing everything almost the same as they showed in their examples, so I would be greatful if anyone could help me please.
Im not sure, but from the function call stack shown above, shouldn't the last line be hmm{train_act}.emiss instead of hmm{act}.emiss.
In other words when you computing the log-probability of a sequence, you should pass components that belong to the same HMM model (transition matrix, emission matrix, and prior probabilities).
By the way, the ASSERT in the code is a sanity check that a vector of probabilities should sum to 1. Oftentimes, when working with very small values (log-probabilities), numerical stability issues can creep in... You could edit the APPROXEQ function to relax the comparison a bit, by giving it a bigger margin of error
This error message and the code it refers to are human-readable. An assertion is a guard put in by the programmer, to ensure that certain conditions are met. In this case, what is the condition? approxeq(sum(alpha(:,t)),1) I'd venture to say that approxeq wants the values to be approximately equal, so this boils down to: sum(alpha(:,t)) ~= 1
Without knowing anything about the code, I'd also guess that these refer to probabilities. The probabilities of a node's edges must sum to one. Hopefully this starts you down a productive debugging path. If you can't figure out what's wrong with your input that produces this condition, start wading into the code a bit to see where this alpha vector comes from, and how it ended up invalid.