フィルターのクリア

How to handle this error: Brace indexing is not supported for variables of this type.

12 ビュー (過去 30 日間)
Sanjana
Sanjana 2023 年 9 月 17 日
回答済み: Sachin 2023 年 9 月 20 日
The error says as :::
Brace indexing is not supported for variables of this type.
Error in lab_3Q2>huffman_encode (line 122)
[prob, symb] = hist(rl_mat{i, j}(:), unique(rl_mat{i, j}));
Error in lab_3Q2 (line 21)
[code, dict] = huffman_encode(run_len);
where rl_mat is a string of double precision array i'm passing
Can someone please rectify the error.
  3 件のコメント
Sanjana
Sanjana 2023 年 9 月 17 日
So, sir is there any way i can use the function for a double precision array. Or can i convert it to a cell array?
Thanks in advance.
Walter Roberson
Walter Roberson 2023 年 9 月 17 日

It looks to me as if you could pass in your double precision array wrapped in a cell array, like

{YourArray} 

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

回答 (1 件)

Sachin
Sachin 2023 年 9 月 20 日
Hi Sanjana,
I understand that you are getting the "Brace indexing is not supported for variables of this type." error.
You are using the "hist" function, which accepts vector or matrix input. Therefore, I would recommend you to double-check the type of value you are passing to the "hist" function.
Refer the following MathWorks documentation to know more about the "hist" function.
Referring to the following MATLAB Answer might be helpful to you.
I hope this resolve your query.
Thanks
Sachin

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by