Error: Brace indexing is not supported for variables of this type.

11 ビュー (過去 30 日間)
Sven Dietrich
Sven Dietrich 2020 年 7 月 30 日
コメント済み: Sven Dietrich 2020 年 7 月 30 日
Hi there,
I am trying to convert a cell into a vector, but I always get the error message: "Brace indexing is not supported for variables of this type."
% Datum korrigieren (date originally is a 14386x1 cell)
date(1,:)=[] ; % remove word
row1 = cell2mat(date(1,:)); % Start time
datenum= str2double(date);
datevec = cell2mat(datenum{:}); % cell to vector
% all elements - row1
The problem must be in line beginning with datevec
Brace indexing is not supported for variables of this type.
Error in location (line 18)
datevec = cell2mat(datenum{:}); % Umwandlung von Cell in Vector
How can I solve it?
And am I right that I can not substract an number from each element of a cell?
  2 件のコメント
Sriram Tadavarty
Sriram Tadavarty 2020 年 7 月 30 日
The variable datenum is not a cell array and thus, the error. Can you provide the data mat file? Also, What is that you are trying to do?
Sven Dietrich
Sven Dietrich 2020 年 7 月 30 日
Oh yes, it's a double.
I want to substract the first element from all elements of this variable.

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

採用された回答

KSSV
KSSV 2020 年 7 月 30 日
編集済み: KSSV 2020 年 7 月 30 日
datevec = cell2mat(datenum);
Or check
class(datenum)
It should be already a converted to double.
  2 件のコメント
KSSV
KSSV 2020 年 7 月 30 日
I want to substract the first element from all elements of this variable.
iwant = datenum-datenum(1) ;
Sven Dietrich
Sven Dietrich 2020 年 7 月 30 日
thank you :)

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDates and Time についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by