필터 지우기
필터 지우기

how to solve this error ''Input #2 expected to be a cell array, was char instead.''

조회 수: 18 (최근 30일)
hello all; how i can olve this error.
Ex_X_vlues=[9,188,505,121,2,91,309,168,126,466,407,496,0];
Ex_Z=[1,5,5,5,0,6,1,7,5,0,6,0,0];
G1=dec2bin(Ex_X_vlues)
G2=dec2bin(Ex_Z)
Ex_group_12_bit=[G1,G2]
Ex_NewRstream=reshape(Ex_group_12_bit',1,[])
EX_bitstream=cell2mat(cellfun(@(s)sscanf(s,'%1f%1f%f'),Ex_group_12_bit, 'UniformOutput',false))
Error using cellfun
Input #2 expected to be a cell array, was char instead.
Error in kuday (line 8)
EX_bitstream=cell2mat(cellfun(@(s)sscanf(s,'%1f%1f%f'),Ex_group_12_bit,
'UniformOutput',false))

답변 (1개)

Image Analyst
Image Analyst 2015년 5월 19일
Wow, you sure know how to string along a bunch of lines of code into one big long single line, don't you? Anyway, if you have some variable and want it to be in a cell, you can enclose it in braces:
myCell = {myDoubleVariable};
  댓글 수: 1
Mohamuud hassan
Mohamuud hassan 2015년 5월 19일
편집: Mohamuud hassan 2015년 5월 19일
my friend what i want is to put each digit in column the coccrect code is here:
Ex_X_vlues=[9,188,505,121,2,91,309,168,126,466,407,496,0];
Ex_Z=[1,5,5,5,0,6,1,7,5,0,6,0,0];
G1=dec2bin(Ex_X_vlues)
G2=dec2bin(Ex_Z)
Ex_group_12_bit=[G1,G2]
Ex_NewRstream=reshape(Ex_group_12_bit',1,[])
% the data in this is store in columns instead of char
EX_bitstream=cell2mat(cellfun(@(s)sscanf(s,'%1f%1f%f'),Ex_group_12_bit, 'UniformOutput',false))

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Data Type Conversion에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by