Thread Subject: Subscript assignment Mismatch

Subject: Subscript assignment Mismatch

From: Hugh

Date: 9 Oct, 2009 13:15:05

Message: 1 of 1

Hi there,

The code below worked fine until I chnaged the import of the text file.

The new file yield2 is esentially similar although slightly more columns.

However as the number of columns or indeed rows is not hard coded I don't see this should cause a problem?

How after changing the code to import yield2.txt the follwoing error message appeared

??? Subscripted assigment dimension mismatch?

Error in ==> curvefit at 11
xdata(i,:)=data(1:);

Please advise




%% datafitting parameters
clc
close all
clear screen
%data= dlmread('yield.txt','\t');
data= dlmread('yield2.txt','\t');
ydata=data(2:end,:);
%ydata=data(2,:);
k=size(ydata);
for i=1:k(1)
xdata(i,:)=data(1,:);
end
%x=eyes(2:end,:);oi

%xdata=data(1,:);
xdata2=[2 5 10 30];
ydata2=[4.3 4.94 5.52 5.95];

xdata3=data(1,:);
ydata3=data(2,:);
%c0 = [1.0 2 3 4];% starting values
c0 = [1 1 1 1 1 1];

%c0 = [1.0 1 1];
lbn = []; % lower bound
ubn = []; % upper bound
options = optimset('LargeScale','on','MaxFunEvals',100000,'TolFun',1e-5,'MaxIter',10000 );


% datafitting
[cn,error]=lsqcurvefit(@PrimePerm,c0,xdata,ydata,lbn,ubn,options);

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
subscripted ass... Hugh 9 Oct, 2009 09:19:03
rssFeed for this Thread

Contact us at files@mathworks.com