Inquiry Regarding Error in axisymmetricBHT Code Execution
Show older comments
I am using HIFU simulator V1.2
I'd like to inquire about an error that occurred while running the code associated with the axisymmetricBHT in the HIFU simulator_v1.2 available on the Matlab website.
The error occurred during the execution of the BHT_plots at the end of the axisymmetricBHT code, specifically on the 15th line of the BHT_plots, which contains the following code:
[C,H]=contour(z,r2,Dmat2,[.1 .1]);
The error message I received states, "Vector Y must be strictly increasing or strictly decreasing with no repeated values."
I would like to inquire what is the problem of this state and if there is any possible solution.
Answers (1)
Angelo Yeo
on 10 Nov 2023
Edited: Angelo Yeo
on 10 Nov 2023
If you were running a code that should be running okay with the toolbox, this must be due to a version compatibility issue. The error message "Vector X must be strictly increasing or strictly decreasing with no repeated values." was introduced from R2014b.
This restriction was made in the age of R2014b, and earlier versions didn't have such limitation. In below example, a one-level contour with three points [1 7 3] will be expected by CONTOUR.
x = [1 7 3];
y = [1 7 3];
Z = [0 0 0; 0 1 0; 0 0 0];
[X,Y] = meshgrid(x, y);
Both below matrix & vector inputs generated a same image as of R2014a:
contour(X, Y, Z, [0.5 0.5]);
hold on
plot(x,y,'r.','MarkerSize',40)
axis equal
hold off
or
contour(x, y, Z, [0.5 0.5]);

However after the date is sorted, the feature absolutely changes and there had been voices that this image is rather acceptable:
[xsorted, ox] = sort(x);
[ysorted, oy] = sort(y);
Zsorted = Z(oy,ox);
contour(xsorted, ysorted, Zsorted, [0.5 0.5]);
hold on
plot(x,y,'r.','MarkerSize',40)
axis equal
hold off

Consequently, the vector-input restriction was made reflecting the voice. See the explanation on input X.
When X is a matrix, the values must be strictly increasing or decreasing along one dimension and remain constant along the other dimension. The dimension that varies must be the opposite of the dimension that varies in Y.
Categories
Find more on Genomics and Next Generation Sequencing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!