Cody

Problem 898. AVIRIS Hyperspectral Bit Mask

Solution 484313

Submitted on 8 Aug 2014 by Binbin Qi
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass
%% m=ones(4,'uint16'); bmv = bitmask(m); assert(isinteger(bmv),sprintf('Non-Integer return')) assert(isequal(bmv,[255 255]))

2   Pass
%% m=zeros(4,'uint16'); m(1)=1; m(16)=1; bmv = bitmask(m); assert(isequal(bmv,[128 1]),[sprintf('Expected [128 1] saw: ') sprintf('%i ',bmv)])

3   Pass
%% m=zeros(3,'uint16'); m(8)=1; m(9)=1; bmv = bitmask(m); assert(isequal(bmv,[1 128]))

4   Pass
%% %Duplicity test m=randi(65535,[8 4],'uint16'); for i=1:12 m(randi(32))=0; end bmv = bitmask(m); mb=m>0; bmv_exp=[128 64 32 16 8 4 2 1]*mb; assert(isequal(bmv,bmv_exp))

5   Pass
%% % Load aviris file Layer 1 ; 1.8MB mat file tic % approx 2.5 sec to write and load %http://rmatlabtest.appspot.com/aviris_moffett_L001.mat urlwrite('http://rmatlabtest.appspot.com/aviris_moffett_L001.mat','aviris_moffett_L001.mat'); toc load('aviris_moffett_L001.mat'); toc % Array variable is L001 %Files also posted are L010,L023,L157, and L158 with same tinyurl format % L010 and L023 have high contrast L157 and L158 are in atmospheric notch bmv=bitmask(L001); % L001 (1:8) [1271 1259 1271 0 0 0 0 0] assert(isequal(bmv(1),224),sprintf('Expected 224 saw: %i',bmv(1))) assert(isequal(bmv(181097),0),sprintf('Expected 0 saw: %i',bmv(181097))) assert(isequal(bmv(90800),255),sprintf('Expected 255 saw: %i',bmv(90800)))

Elapsed time is 0.510217 seconds. Elapsed time is 0.541743 seconds.

Suggested Problems

More from this Author246

Community Treasure Hunt

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

Start Hunting!