MATLAB Answers

Cellarray in a dlarray

9 ビュー (過去 30 日間)
Valerio Spennato
Valerio Spennato 2021 年 4 月 15 日
回答済み: Joss Knight 2021 年 4 月 22 日
Hello, I have a cell array and i want to transform it in a dlarray. Is that possible?
I have to put it in dlfeval and now i have this error:
first input arguments must be a formatted dlarray...
  1 件のコメント
Jan
Jan 2021 年 4 月 15 日
This sounds, like the 1st input is not a formatted dlarray. Why does Matlab think, that this is the case? Based on the lean given information the readers have no chance to guess this.

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

回答 (2 件)

Mahesh Taparia
Mahesh Taparia 2021 年 4 月 19 日
Hi
The dlarray is supported for full arrays of data type double, single, or logical, or for full gpuArrays. Use cell2mat function to convert the cell to an ordinary array and then convert it to dlarray. For more information, refer its documentation here.

Joss Knight
Joss Knight 2021 年 4 月 22 日
dlCell = cellfun(@dlarray, myCell, 'UniformOutput', false);

Community Treasure Hunt

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

Start Hunting!

Translated by