# MATLAB: Selection of Matrix Elements without for loop

arrayimage processingMATLAB and Simulink Student Suitematrix

Hi.
I have a matrix of cooardinates like this :
``A = [1 3;2 4;7 9];``
And a Matrix 9×9:
``B = rand(9);``
How can I select B's elements in A cooardinest (for example : B(1,3) & B(2,4) & B(7,9)) without using a for loop.
Assuming that in my original code A has too many rows, ( more than 10K) and B is an image with too many points either.
As a matter of fact, I have some pixels' coordinates, and want to just update their's value in the original image by some formula. But I don't want to use for loop for selecting each pixel.

• ``B(sub2ind(size(B),A(:,1),A(:,2)))``
{"ft_lang_label":"__label__en","ft_lang_prob":0.93451524,"math_prob":0.9606321,"size":532,"snap":"2020-45-2020-50","text_gpt3_token_len":162,"char_repetition_ratio":0.08143939,"word_repetition_ratio":0.0,"special_character_ratio":0.31015038,"punctuation_ratio":0.13953489,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9939918,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2020-11-27T23:15:00Z\",\"WARC-Record-ID\":\"<urn:uuid:e01a1349-207a-4db9-b5dc-1cc31f640f6a>\",\"Content-Length\":\"12105\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:771e2280-9ce4-480a-ac1b-8934bf20c4fe>\",\"WARC-Concurrent-To\":\"<urn:uuid:fb64c927-982b-4598-959b-99e012388eeb>\",\"WARC-IP-Address\":\"45.76.174.189\",\"WARC-Target-URI\":\"https://itectec.com/matlab/matlab-selection-of-matrix-elements-without-for-loop/\",\"WARC-Payload-Digest\":\"sha1:E44ASWCRRM6MFHBSKBOXQJQ3NDYFVLQG\",\"WARC-Block-Digest\":\"sha1:PANITHQOKXTRDKRJZRTQL7A4WAX227DN\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2020/CC-MAIN-2020-50/CC-MAIN-2020-50_segments_1606141194634.29_warc_CC-MAIN-20201127221446-20201128011446-00212.warc.gz\"}"}