Hex mask on all table column elements

조회 수: 7 (최근 30일)
Kashmir Singh
Kashmir Singh 2016년 1월 21일
답변: Kashmir Singh 2016년 2월 3일
Attempting to set mask "0x0FFF" on all table column elements of "Ecuc_samp_27".
Receiving following error at present "Error using & Matrix dimensions must agree".
Sample code as follows:
Ecuc_samp_27=dec2hex(CCPEcuC_var_Adc__0__CoherentSample__27__t0_idx,4);
EcuC_samp_27_masked= Ecuc_samp_27 & ('0FFF');
Ecuc_samp_27_dec=hex2dec(EcuC_samp_27_masked);

채택된 답변

Walter Roberson
Walter Roberson 2016년 1월 21일
Ecuc_samp_27_dec = bitand(CCPEcuC_var_Adc__0__CoherentSample__27__t0_idx, hex2dec('0FFF'), 'uint16')

추가 답변 (2개)

Guillaume
Guillaume 2016년 1월 21일
matlab does not use the &, |, etc. operators for bit-wise operations, and these do not apply to string anyway. Bit-wise operations are achieved throught bitand, bitor, etc.:
Ecuc_samp_27_dec = bitand(CCPEcuC_var_Adc__0__CoherentSample__27__t0_idx, hex2dec('0fff'))

Kashmir Singh
Kashmir Singh 2016년 2월 3일
Thanks

카테고리

Help CenterFile Exchange에서 Author Block Masks에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by