How to avoid Dec2Hex non-negative integer error
2 ビュー (過去 30 日間)
古いコメントを表示
I'm currently trying to convert a range of cells imported from a .csv from decimal to hex. However, I keep getting the error:
First argument must contain non-negative integers.
This is despite there not being any negative integers at all in the dataset. This is my current code:
f = @(x) dec2hex(round(x));
dataHex = [data(:, 1), varfun(f, data(:, 2:width(data)))];
Any help would be greatly appreciated.
0 件のコメント
採用された回答
Walter Roberson
2017 年 5 月 24 日
編集済み: Walter Roberson
2017 年 5 月 24 日
You would get that message with that code if some of your values are nan.
Missing data could show up as NaN.
0 件のコメント
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!