Effacer les filtres
Effacer les filtres

How to avoid Dec2Hex non-negative integer error

3 vues (au cours des 30 derniers jours)
Matt
Matt le 24 Mai 2017
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.

Réponse acceptée

Walter Roberson
Walter Roberson le 24 Mai 2017
Modifié(e) : Walter Roberson le 24 Mai 2017
You would get that message with that code if some of your values are nan.
Missing data could show up as NaN.

Plus de réponses (0)

Catégories

En savoir plus sur Numeric Types dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by