Create Array from list of indices/valuesIs there a faster way to create a matrix of indices from ragged data?Efficient submatrix swaps for large sparse matrixHow to create automatically some matrices for symbolic manipulation?How to partition a 2-D array properly?How to convert an output of a matrix into a PNG image?Plotting points using adjacency matrixFind the indices of elements which are larger than 10 in a listExtract a matrix from a ListInterpolationReplace elements of a matrix with zeros using another matrixConverting from “matrix” data into “coordinate” data

Use chown -R while excluding one or two files

Operation Unz̖̬̜̺̬a͇͖̯͔͉l̟̭g͕̝̼͇͓̪͍o̬̝͍̹̻

Vienna To Graz By Rail

Does this sentence I constructed with my junior high school latin work? I write online advertising and want to come off as snobby as possible

At which point can a system be compromised when downloading archived data from an untrusted source?

Random piece of plastic

Can a Resident Assistant be told to ignore a lawful order?'

How fast does a character need to move to be effectively invisible?

Is it legal for a supermarket to refuse to sell an adult beer if an adult with them doesn’t have their ID?

What would be the safest way to drop thousands of small, hard objects from a typical, high wing, GA airplane?

Is there a typesafe way to get a Database.QueryLocator?

ArcPy Delete Function not working inside for loop?

Generating a PIN from cryptographic bytes

Cover a cube with four-legged walky-squares!

Do dragons smell of lilacs?

What "fuel more powerful than anything the West (had) in stock" put Laika in orbit aboard Sputnik 2?

Coverting list of string into integers and reshaping the original list

What are the first usages of "thong" as a wearable item of clothing, both on the feet and on the waist?

Is straight-up writing someone's opinions telling?

A scene of Jimmy diversity

Why is the total probability theorem expressed in this way?

What happens if there is no space for entry stamp in the passport for US visa?

What does it actually mean to have two time dimensions?

How Can I Process Untrusted Data Sources Securely?



Create Array from list of indices/values


Is there a faster way to create a matrix of indices from ragged data?Efficient submatrix swaps for large sparse matrixHow to create automatically some matrices for symbolic manipulation?How to partition a 2-D array properly?How to convert an output of a matrix into a PNG image?Plotting points using adjacency matrixFind the indices of elements which are larger than 10 in a listExtract a matrix from a ListInterpolationReplace elements of a matrix with zeros using another matrixConverting from “matrix” data into “coordinate” data






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








8












$begingroup$


Is there is a performat way to convert something like



0,0,a,0,1,c,1,0,d,1,1,e


into




a,b,c,d



The indices are not always orderes and the only solution I can think of is searching for the maximum indices, create a matrix filled with 0 and use map afterwards to modify the matrix.
Is there is a better way?



Thank you,
Martin










share|improve this question









New contributor



Martin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






$endgroup$







  • 2




    $begingroup$
    I assume that when you write 0,0,a,0,1,c,1,0,d,1,1,e you actually mean 0, 0, a, 0, 1, b, 1, 0, c, 1, 1, d, Please check that the input is correct.
    $endgroup$
    – rhermans
    11 hours ago


















8












$begingroup$


Is there is a performat way to convert something like



0,0,a,0,1,c,1,0,d,1,1,e


into




a,b,c,d



The indices are not always orderes and the only solution I can think of is searching for the maximum indices, create a matrix filled with 0 and use map afterwards to modify the matrix.
Is there is a better way?



Thank you,
Martin










share|improve this question









New contributor



Martin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






$endgroup$







  • 2




    $begingroup$
    I assume that when you write 0,0,a,0,1,c,1,0,d,1,1,e you actually mean 0, 0, a, 0, 1, b, 1, 0, c, 1, 1, d, Please check that the input is correct.
    $endgroup$
    – rhermans
    11 hours ago














8












8








8


1



$begingroup$


Is there is a performat way to convert something like



0,0,a,0,1,c,1,0,d,1,1,e


into




a,b,c,d



The indices are not always orderes and the only solution I can think of is searching for the maximum indices, create a matrix filled with 0 and use map afterwards to modify the matrix.
Is there is a better way?



Thank you,
Martin










share|improve this question









New contributor



Martin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






$endgroup$




Is there is a performat way to convert something like



0,0,a,0,1,c,1,0,d,1,1,e


into




a,b,c,d



The indices are not always orderes and the only solution I can think of is searching for the maximum indices, create a matrix filled with 0 and use map afterwards to modify the matrix.
Is there is a better way?



Thank you,
Martin







list-manipulation matrix conversion






share|improve this question









New contributor



Martin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.










share|improve this question









New contributor



Martin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.








share|improve this question




share|improve this question








edited 11 hours ago









Kuba

110k12 gold badges217 silver badges554 bronze badges




110k12 gold badges217 silver badges554 bronze badges






New contributor



Martin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.








asked 11 hours ago









MartinMartin

411 bronze badge




411 bronze badge




New contributor



Martin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




New contributor




Martin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









  • 2




    $begingroup$
    I assume that when you write 0,0,a,0,1,c,1,0,d,1,1,e you actually mean 0, 0, a, 0, 1, b, 1, 0, c, 1, 1, d, Please check that the input is correct.
    $endgroup$
    – rhermans
    11 hours ago













  • 2




    $begingroup$
    I assume that when you write 0,0,a,0,1,c,1,0,d,1,1,e you actually mean 0, 0, a, 0, 1, b, 1, 0, c, 1, 1, d, Please check that the input is correct.
    $endgroup$
    – rhermans
    11 hours ago








2




2




$begingroup$
I assume that when you write 0,0,a,0,1,c,1,0,d,1,1,e you actually mean 0, 0, a, 0, 1, b, 1, 0, c, 1, 1, d, Please check that the input is correct.
$endgroup$
– rhermans
11 hours ago





$begingroup$
I assume that when you write 0,0,a,0,1,c,1,0,d,1,1,e you actually mean 0, 0, a, 0, 1, b, 1, 0, c, 1, 1, d, Please check that the input is correct.
$endgroup$
– rhermans
11 hours ago











3 Answers
3






active

oldest

votes


















9












$begingroup$

spec = 0, 0, a, 0, 1, b, 1, 0, c, 1, 1, d;

Normal @ SparseArray[# + 1 -> #2 & @@@ spec]



a, b, c, d







share|improve this answer









$endgroup$




















    7












    $begingroup$

    Also possible:



    r = 0, 0, a, 0, 1, c, 1, 0, d, 1, 1, e;
    SparseArray[r[[All, 1]] + 1 -> r[[All, 2]]]





    share|improve this answer









    $endgroup$




















      1












      $begingroup$

      (Array[#1, #2 &, 2, 2]-1)/.Rule@@@list



      a, b, c, d




      where



      list=0, 0, a, 0, 1, b, 1, 0, c, 1, 1, d;





      share|improve this answer









      $endgroup$












      • $begingroup$
        I think you misinterpret the question. The index may not be limited by 2.
        $endgroup$
        – rhermans
        8 hours ago













      Your Answer








      StackExchange.ready(function()
      var channelOptions =
      tags: "".split(" "),
      id: "387"
      ;
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function()
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled)
      StackExchange.using("snippets", function()
      createEditor();
      );

      else
      createEditor();

      );

      function createEditor()
      StackExchange.prepareEditor(
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: false,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      bindNavPrevention: true,
      postfix: "",
      imageUploader:
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      ,
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      );



      );






      Martin is a new contributor. Be nice, and check out our Code of Conduct.









      draft saved

      draft discarded


















      StackExchange.ready(
      function ()
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f202244%2fcreate-array-from-list-of-indices-values%23new-answer', 'question_page');

      );

      Post as a guest















      Required, but never shown

























      3 Answers
      3






      active

      oldest

      votes








      3 Answers
      3






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      9












      $begingroup$

      spec = 0, 0, a, 0, 1, b, 1, 0, c, 1, 1, d;

      Normal @ SparseArray[# + 1 -> #2 & @@@ spec]



      a, b, c, d







      share|improve this answer









      $endgroup$

















        9












        $begingroup$

        spec = 0, 0, a, 0, 1, b, 1, 0, c, 1, 1, d;

        Normal @ SparseArray[# + 1 -> #2 & @@@ spec]



        a, b, c, d







        share|improve this answer









        $endgroup$















          9












          9








          9





          $begingroup$

          spec = 0, 0, a, 0, 1, b, 1, 0, c, 1, 1, d;

          Normal @ SparseArray[# + 1 -> #2 & @@@ spec]



          a, b, c, d







          share|improve this answer









          $endgroup$



          spec = 0, 0, a, 0, 1, b, 1, 0, c, 1, 1, d;

          Normal @ SparseArray[# + 1 -> #2 & @@@ spec]



          a, b, c, d








          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered 11 hours ago









          KubaKuba

          110k12 gold badges217 silver badges554 bronze badges




          110k12 gold badges217 silver badges554 bronze badges























              7












              $begingroup$

              Also possible:



              r = 0, 0, a, 0, 1, c, 1, 0, d, 1, 1, e;
              SparseArray[r[[All, 1]] + 1 -> r[[All, 2]]]





              share|improve this answer









              $endgroup$

















                7












                $begingroup$

                Also possible:



                r = 0, 0, a, 0, 1, c, 1, 0, d, 1, 1, e;
                SparseArray[r[[All, 1]] + 1 -> r[[All, 2]]]





                share|improve this answer









                $endgroup$















                  7












                  7








                  7





                  $begingroup$

                  Also possible:



                  r = 0, 0, a, 0, 1, c, 1, 0, d, 1, 1, e;
                  SparseArray[r[[All, 1]] + 1 -> r[[All, 2]]]





                  share|improve this answer









                  $endgroup$



                  Also possible:



                  r = 0, 0, a, 0, 1, c, 1, 0, d, 1, 1, e;
                  SparseArray[r[[All, 1]] + 1 -> r[[All, 2]]]






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered 11 hours ago









                  Henrik SchumacherHenrik Schumacher

                  65.3k5 gold badges94 silver badges180 bronze badges




                  65.3k5 gold badges94 silver badges180 bronze badges





















                      1












                      $begingroup$

                      (Array[#1, #2 &, 2, 2]-1)/.Rule@@@list



                      a, b, c, d




                      where



                      list=0, 0, a, 0, 1, b, 1, 0, c, 1, 1, d;





                      share|improve this answer









                      $endgroup$












                      • $begingroup$
                        I think you misinterpret the question. The index may not be limited by 2.
                        $endgroup$
                        – rhermans
                        8 hours ago















                      1












                      $begingroup$

                      (Array[#1, #2 &, 2, 2]-1)/.Rule@@@list



                      a, b, c, d




                      where



                      list=0, 0, a, 0, 1, b, 1, 0, c, 1, 1, d;





                      share|improve this answer









                      $endgroup$












                      • $begingroup$
                        I think you misinterpret the question. The index may not be limited by 2.
                        $endgroup$
                        – rhermans
                        8 hours ago













                      1












                      1








                      1





                      $begingroup$

                      (Array[#1, #2 &, 2, 2]-1)/.Rule@@@list



                      a, b, c, d




                      where



                      list=0, 0, a, 0, 1, b, 1, 0, c, 1, 1, d;





                      share|improve this answer









                      $endgroup$



                      (Array[#1, #2 &, 2, 2]-1)/.Rule@@@list



                      a, b, c, d




                      where



                      list=0, 0, a, 0, 1, b, 1, 0, c, 1, 1, d;






                      share|improve this answer












                      share|improve this answer



                      share|improve this answer










                      answered 8 hours ago









                      user1066user1066

                      6,4482 gold badges20 silver badges33 bronze badges




                      6,4482 gold badges20 silver badges33 bronze badges











                      • $begingroup$
                        I think you misinterpret the question. The index may not be limited by 2.
                        $endgroup$
                        – rhermans
                        8 hours ago
















                      • $begingroup$
                        I think you misinterpret the question. The index may not be limited by 2.
                        $endgroup$
                        – rhermans
                        8 hours ago















                      $begingroup$
                      I think you misinterpret the question. The index may not be limited by 2.
                      $endgroup$
                      – rhermans
                      8 hours ago




                      $begingroup$
                      I think you misinterpret the question. The index may not be limited by 2.
                      $endgroup$
                      – rhermans
                      8 hours ago










                      Martin is a new contributor. Be nice, and check out our Code of Conduct.









                      draft saved

                      draft discarded


















                      Martin is a new contributor. Be nice, and check out our Code of Conduct.












                      Martin is a new contributor. Be nice, and check out our Code of Conduct.











                      Martin is a new contributor. Be nice, and check out our Code of Conduct.














                      Thanks for contributing an answer to Mathematica Stack Exchange!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid


                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.

                      Use MathJax to format equations. MathJax reference.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f202244%2fcreate-array-from-list-of-indices-values%23new-answer', 'question_page');

                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Canceling a color specificationRandomly assigning color to Graphics3D objects?Default color for Filling in Mathematica 9Coloring specific elements of sets with a prime modified order in an array plotHow to pick a color differing significantly from the colors already in a given color list?Detection of the text colorColor numbers based on their valueCan color schemes for use with ColorData include opacity specification?My dynamic color schemes

                      Invision Community Contents History See also References External links Navigation menuProprietaryinvisioncommunity.comIPS Community ForumsIPS Community Forumsthis blog entry"License Changes, IP.Board 3.4, and the Future""Interview -- Matt Mecham of Ibforums""CEO Invision Power Board, Matt Mecham Is a Liar, Thief!"IPB License Explanation 1.3, 1.3.1, 2.0, and 2.1ArchivedSecurity Fixes, Updates And Enhancements For IPB 1.3.1Archived"New Demo Accounts - Invision Power Services"the original"New Default Skin"the original"Invision Power Board 3.0.0 and Applications Released"the original"Archived copy"the original"Perpetual licenses being done away with""Release Notes - Invision Power Services""Introducing: IPS Community Suite 4!"Invision Community Release Notes

                      199年 目錄 大件事 到箇年出世嗰人 到箇年死嗰人 節慶、風俗習慣 導覽選單