フィルターのクリア

Convert Distributed Array to Matrix

2 ビュー (過去 30 日間)
Jacob Brinkmann
Jacob Brinkmann 2012 年 6 月 29 日
回答済み: shrouk mohamed 2018 年 10 月 20 日
I have a distributed array created using:
cal_data=distributed.zeros(1,2);
I would like to convert the array to a matrix, to use the curve fitting toolbox:
xdata=zeros(1,2);
xdata(:)=cal_data;
I get the following error:
The following error occurred converting from distributed to double: Conversion to double from distributed is not possible
Please help me.
Thanks for your time,
Jake Brinkmann
R2011b

回答 (2 件)

Jill Reese
Jill Reese 2012 年 6 月 29 日
The functionality you are looking for is "gather":
xdata = gather(cal_data);
If you don't mind my asking, what particular functionality are you trying to use in the Curve Fitting Toolbox? We are always interested to hear what operations our customers want to use with distributed arrays.
  2 件のコメント
Jacob Brinkmann
Jacob Brinkmann 2012 年 6 月 29 日
編集済み: Walter Roberson 2012 年 7 月 2 日
>>[fresult,gof,output]=fit(xdata,ydata,'poly1',opts);
Warning: Converting X to matrix of double.
> In fit>iCreateWarningFunction/nThrowWarning at 738
In fit>iFit at 144
In fit at 109
In tirs_datasets at 104
In tirs_tool_v2>files_calculate_button_Callback at 274
In gui_mainfcn at 96
In tirs_tool_v2 at 50
In @(hObject,eventdata)tirs_tool_v2('files_calculate_button_Callback',hObject,eventdata,guidata(hObject))
Error using distributed/subsref (line 33)
Distributed SUBSREF currently only supports () indexing.
Error in fit>iFit (line 461)
[~, A] = feval(model,coefftemp{:},probparams{:},xdatacell{:});
Error in fit (line 109)
[fitobj, goodness, output, convmsg] = iFit( xdatain, ydatain, fittypeobj, ...
Jill Reese
Jill Reese 2012 年 7 月 2 日
Jacob,
Unfortunately, some of the MATLAB functions used by the Curve Fitting Toolbox's fit function are not currently implemented for distributed arrays. In the interim, if you need a simple linear fit to data you might check if polyfit has the functionality you need. I tried some simple examples and it seems like polyfit works with distributed arrays if the first input argument is not distributed but the second one is.
B=1:1000;
A=2*B-4;
z=polyfit(B,distributed(A),1);

サインインしてコメントする。


shrouk mohamed
shrouk mohamed 2018 年 10 月 20 日
Thank you, this was helpful.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by