フィルターのクリア

Question about translating hexadecimal character cell

1 回表示 (過去 30 日間)
Brian
Brian 2013 年 5 月 24 日
Hello, thanks for reading this,
I have a n*5 cell of character elements that represent hexadecimal numbers. I want to take this and convert it to decimal matrix.
What I do is search through a text file, and with the lines:
while (isempty(strfind(tline,faceMatrixEnd)) )
vVolumeFaceMx(volumeCounter,:) = textscan(tline, '%s %s %s %s %s', 'delimiter', ' ');
tline = fgetl(fid_source);
volumeCounter = volumeCounter+1;
end
I create a cell with n*5 columns, each cell element containing a string.
For instance, I can translate one element into a decimal value using:
sscanf(my_matrix{1,1}{1,1}, '%x')
but if I wanted to do this for my entire cell, what I would do right now is use loops, which would take a while.
Is there an faster and easier way to do this?

採用された回答

Brian
Brian 2013 年 5 月 24 日
I bypassed this problem by using a different command to read the text file.
using the code:
vVolumeFaceMx(:,volumeCounter) = sscanf(tline, '%x %x %x %x %x');
tline = fgetl(fid_source);
volumeCounter = volumeCounter+1;
allowed me to read it into a hexadecimal format to begin with.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCell Arrays についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by