Re: [問題]有關cfun
: the following error occurred converting from cfit to double
: error using=>double
: conversion to double from cfit is not possible
: error in=>bbfit(i,:)=cfun
因為cfun不是數字
所以不能存到矩陣中
我想到的解決方法有2
1
把你fit的那行output的cfun另成5000個變數
每個變數自己存自己的cfun
bb=rand(5000,30) ;
bbfit=zeros(5000,30);
for i=1:5000
a=1:30;
b=bb(i,:);
eval(['[cfun' num2str(i) ',gov,output]=fit(a'',b'',''poly5'')']);
end
2
把cfun放到structure裡面
bbfit=zeros(5000,30);
for i=1:2
a=1:30;
b=bb(i,:);
[cfun,gov,output]=fit(a',b','poly5');
Data(i).cfun=cfun;
end
參考看看
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.112.103.220
推
05/15 09:29, , 1F
05/15 09:29, 1F
討論串 (同標題文章)