Index exceeds matrix dimensions
Mostrar comentarios más antiguos
Hi, the script i am working on is:
a = {'not follow', 'we are not ready', 'dont call',...
'footpush not pressed', 'proximity selected', 'clear hoist',...
'stop loading', 'no sequence start'};
b = {'follow', 'we are ready', 'call', 'footpush pressed',...
'call DA selected', 'load hoist', 'load bag', 'sequence start'};
x = dec2bin(hex2dec('7F'));
for i = 0:7
if x(7 - i + 1) == '0'
disp(a{i+1})
else
disp(b{i+1});
end
end
My code works fine when the hex value entered is between '80' and 'FF' however when i enter hex values between '00' and '7F' i get an error saying:
Index exceeds matrix dimensions.
Error in script (line 8)
if x(7 - i + 1) == '0'
Any help is much appreciated.
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Numbers and Precision en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!