print hexadecimal representation of 16 bit word
52 ビュー (過去 30 日間)
古いコメントを表示
I keep messing it up
I've got a 16 bit word that's supposed to be the hexadecimal representation of a number.
How do I print that hexadecimal representation?
0 件のコメント
回答 (1 件)
dpb
2025 年 11 月 10 日 14:40
Somewhat dependent upon the context, but some options include
V=65535;
fprintf('%s\n',dec2hex(V)) % convert to internal string
fprintf('%X\n',V) % use builtin format conversion
If this doesn't resolve whatever issues you're having, show us the context of the problem and what you're trying to do, specifically.
4 件のコメント
dpb
2025 年 11 月 10 日 17:46
The alternative would be to store =DEC2HEX(value) in the cell of interest(*), but you might be forced to actually write to Excel directly for it to recognize and interpret/evaluate the formula on opening a .csv file; I've not ever tried that. I write formulas all the time, but use writecell with the 'UseExcel',1 parameter.
(*) But, that also converts that cell to text so to calculate with it, formulas referencing the cell will have to do the conversion back as well just as if stored the explicit text representation.
参考
カテゴリ
Help Center および File Exchange で Spreadsheets についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!