Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
MATLAB
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Functions === When creating a MATLAB function, the name of the file should match the name of the first function in the file. Valid function names begin with an alphabetic character, and can contain letters, numbers, or underscores. Variables and functions are case sensitive.<ref>{{cite web|title=Case and Space Sensitivity|url=https://www.mathworks.com/help/matlab/matlab_prog/case-and-space-sensitivity.html|publisher=MathWorks|access-date=November 1, 2019}}</ref> {{sxhl|2=matlab|1= rgbImage = imread('ecg.png'); grayImage = rgb2gray(rgbImage); % for non-indexed images level = graythresh(grayImage); % threshold for converting image to binary, binaryImage = im2bw(grayImage, level); % Extract the individual red, green, and blue color channels. redChannel = rgbImage(:, :, 1); greenChannel = rgbImage(:, :, 2); blueChannel = rgbImage(:, :, 3); % Make the black parts pure red. redChannel(~binaryImage) = 255; greenChannel(~binaryImage) = 0; blueChannel(~binaryImage) = 0; % Now recombine to form the output image. rgbImageOut = cat(3, redChannel, greenChannel, blueChannel); imshow(rgbImageOut); }}
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)