Error: Assignment has more non-singleton rhs dimensions than non-singleton subscripts
Show older comments
Hi,
I have been working in a code to detect the point where a line intersects a curve. In order to do that I have been using the function polyxpoly.
clear all
clc
file = csvread('PSD_ETSI.csv',1); %Reading PSD file
skew = file(:,1); %Taking skew value from file
psd = file(:,2); %Taking psd value from file
margin = 4; %Selecting margin
for i=1:length(skew)
sk_0max(:,:,i) = plus(skew(i).*ones(length(skew),1),margin.*ones(length(skew),1)); %Evaluating margin
psd_0(:,1,i) = psd.*ones(length(skew),1);
skew_0(:,1,i) = skew.*ones(length(skew),1);
[x_0max(:,:,i),y_0max(:,:,i)] = polyxpoly(sk_0max(:,:,i),psd_0(:,1,i),skew,psd,'unique');
hold on
plot(skew,psd)
plot(sk_0max(:,:,i),psd)
end
The thing with the code is that it works fine for some margin values but for some others it just breaks the code and show the non-singleton rhs error . I have debugged the code and I have seen that at some values of i the values at x_0max,y_0max appears to be empty, the thing is that I cannot understand why.
I attached the .csv file in case you want to run the code and try it. The margins that I have been testing are between 0 and 9.
I would appreciate any hint or help regarding to this.
Best regards.
Accepted Answer
More Answers (0)
Categories
Find more on Get Started with MATLAB in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!