Question: Please turn this MatLab for loop scripts to a Finction , I need a MatLab Fuction . clc clear hexl- 'AA102FDE2FDEAA1012341234AAAAA hex2- '2FDEAA10AA102FDE1234123401234'; size -length(hexl);
clc clear hexl- 'AA102FDE2FDEAA1012341234AAAAA hex2- '2FDEAA10AA102FDE1234123401234'; size -length(hexl); result-""" carry 0; for i-size:-1:1 num 1 =typecast(uint64(hex2dec(hex l (i))), 'int64'); num2-typecast(uint64(hex2dec(hex2(i))), 'int64); bothSum -numl + num2+carry; carry 0; if bothSum>16 bothSum = bothSum-16; carry -1; end add -dec2hex(typecast(bothSum, 'uint64')); result- result+add; end if carry ~-0 result- result+carry end result-reverse(result); result
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
