# New to Julia

**URL:** https://discourse.julialang.org/c/first-steps/8.md?page=41

[Latest](https://discourse.julialang.org/latest.md) · [Categories](https://discourse.julialang.org/categories.md) · [Tags](https://discourse.julialang.org/tags.md)

**Page:** 42

---

## [Two Julia pearls](https://discourse.julialang.org/t/two-julia-pearls/116352)

<div class="topic-metadata">

**Author:** [@sbacelar](https://discourse.julialang.org/u/sbacelar)\
**Replies:** 2\
**Last updated:** [June 28, 2024, 11:50am UTC](https://discourse.julialang.org/t/two-julia-pearls/116352 "2024-06-28T11:50:35Z")

</div>

While trying once again to find if there was any Julia version of the Classic Computer Science Problems by David Kopec (there are versions in Python, Java, Rust, JavaScript and others in GitHub - davecom/ClassicComputerS…

---

## [Best Practices to Use Global States in Julia?](https://discourse.julialang.org/t/best-practices-to-use-global-states-in-julia/116283)

<div class="topic-metadata">

**Author:** [@Jake\_W\_Liu](https://discourse.julialang.org/u/Jake_W_Liu)\
**Replies:** 6\
**Last updated:** [June 27, 2024, 1:11pm UTC](https://discourse.julialang.org/t/best-practices-to-use-global-states-in-julia/116283 "2024-06-27T13:11:29Z")

</div>

Hi everyone! I’m trying to define some global states inside my module, but am also concerned about how to elevate the performance… I have done some research on this, some suggests that to use a struct to pack the state…

---

## [Julia within obsidian notes](https://discourse.julialang.org/t/julia-within-obsidian-notes/102465)

<div class="topic-metadata">

**Author:** [@Matthew\_Pocock](https://discourse.julialang.org/u/Matthew_Pocock)\
**Replies:** 7\
**Last updated:** [June 27, 2024, 10:16am UTC](https://discourse.julialang.org/t/julia-within-obsidian-notes/102465 "2024-06-27T10:16:47Z")

</div>

Hi. I’m using Obsidian (https://obsidian.md/) to take notes, and wanted to include some Julia code within my notes. What I really want is some way to treat a particular obsidian markdown file like a julia workbook. In pa…

---

## [UndefRefError while running code based on "Automatically Discover Missing Physics by embedding Machine Learning into Differential Equations"](https://discourse.julialang.org/t/undefreferror-while-running-code-based-on-automatically-discover-missing-physics-by-embedding-machine-learning-into-differential-equations/116228)

<div class="topic-metadata">

**Author:** [@MINimal-Code](https://discourse.julialang.org/u/MINimal-Code)\
**Replies:** 3\
**Last updated:** [June 26, 2024, 1:15pm UTC](https://discourse.julialang.org/t/undefreferror-while-running-code-based-on-automatically-discover-missing-physics-by-embedding-machine-learning-into-differential-equations/116228 "2024-06-26T13:15:33Z")

</div>

Hi there, first time posting a question on this forum, I hope I’m doing this right. I am currently trying to modify the code posted in the documentation Automatically Discover Missing Physics by Embedding Machine Learni…

---

## [If condition with a vector comparison](https://discourse.julialang.org/t/if-condition-with-a-vector-comparison/116256)

<div class="topic-metadata">

**Author:** [@Sahil\_Khan](https://discourse.julialang.org/u/Sahil_Khan)\
**Replies:** 7\
**Last updated:** [June 26, 2024, 12:53pm UTC](https://discourse.julialang.org/t/if-condition-with-a-vector-comparison/116256 "2024-06-26T12:53:30Z")

</div>

Hello, im trying to make a if condition where I can compare a variable to any value of vector and if it matches to any condition, it counted as true… Example: a = 3 if a == any(\[1, 2, 3, 4\]) # imaginary function any…

---

## [Porting code from MatLab - performance tips](https://discourse.julialang.org/t/porting-code-from-matlab-performance-tips/116243)

<div class="topic-metadata">

**Author:** [@Qmot](https://discourse.julialang.org/u/Qmot)\
**Replies:** 18\
**Last updated:** [June 26, 2024, 9:12am UTC](https://discourse.julialang.org/t/porting-code-from-matlab-performance-tips/116243 "2024-06-26T09:12:43Z")

</div>

Hello, so I am an undergrad porting code from MatLab into Julia with the objective of improving performance, but so far performance has been disappointing: Julia: 58 seconds/instance, MatLab: 18 seconds/instance (thousan…

---

## [Porting code from MatLab - performance improvement tricks](https://discourse.julialang.org/t/porting-code-from-matlab-performance-improvement-tricks/116241)

<div class="topic-metadata">

**Author:** [@Qmot](https://discourse.julialang.org/u/Qmot)\
**Replies:** 0\
**Last updated:** [June 26, 2024, 3:28am UTC](https://discourse.julialang.org/t/porting-code-from-matlab-performance-improvement-tricks/116241 "2024-06-26T03:28:17Z")

</div>

(topic deleted by author)

---

## [Accessing Variable Values Dynamically in Julia](https://discourse.julialang.org/t/accessing-variable-values-dynamically-in-julia/116136)

<div class="topic-metadata">

**Author:** [@Jake\_W\_Liu](https://discourse.julialang.org/u/Jake_W_Liu)\
**Replies:** 13\
**Last updated:** [June 25, 2024, 1:38am UTC](https://discourse.julialang.org/t/accessing-variable-values-dynamically-in-julia/116136 "2024-06-25T01:38:45Z")

</div>

Hi! I’m not sure how to choose my title :sweat\_smile: For example, if I specify my output as a string value "a", which means I want to get the value of variable a inside the main function, then after passing this string…

---

## [Plotting with break in axis using Plot.jl](https://discourse.julialang.org/t/plotting-with-break-in-axis-using-plot-jl/116140)

<div class="topic-metadata">

**Author:** [@Sahil\_Khan](https://discourse.julialang.org/u/Sahil_Khan)\
**Replies:** 6\
**Last updated:** [June 24, 2024, 3:11pm UTC](https://discourse.julialang.org/t/plotting-with-break-in-axis-using-plot-jl/116140 "2024-06-24T15:11:44Z")

</div>

I have data with has same y-axis range but for x-axis it has two different set of datapoints at far locations. Now plan is to plot them together with a break in x-axis. I was trying initially with just directly using Pl…

---

## [How do I create an array with random unique numbers in a specific range?](https://discourse.julialang.org/t/how-do-i-create-an-array-with-random-unique-numbers-in-a-specific-range/115901)

<div class="topic-metadata">

**Author:** [@kwellstein](https://discourse.julialang.org/u/kwellstein)\
**Replies:** 20\
**Last updated:** [June 24, 2024, 11:53am UTC](https://discourse.julialang.org/t/how-do-i-create-an-array-with-random-unique-numbers-in-a-specific-range/115901 "2024-06-24T11:53:30Z")

</div>

Hi everyone! I have been googling and spending time in stackexchange but to no avail, I hope someone on here can help me out. What I need is an array with 30 UNIQUE random integers between 1 and 40. Somehow this seems …

---

## [Is there any way to emulate MATLAB's Isqlin in Julia?](https://discourse.julialang.org/t/is-there-any-way-to-emulate-matlabs-isqlin-in-julia/93394)

<div class="topic-metadata">

**Author:** [@Itzi](https://discourse.julialang.org/u/Itzi)\
**Replies:** 20\
**Last updated:** [June 24, 2024, 11:31am UTC](https://discourse.julialang.org/t/is-there-any-way-to-emulate-matlabs-isqlin-in-julia/93394 "2024-06-24T11:31:16Z")

</div>

Hi, I am trying to solve a box constrained least squares problem. I have the classic Ax = b problem where x are the parameters I want to find, and A and b are full of experimental data. I have tried: using Convex, SC…

---

## [How to determine when to broadcast](https://discourse.julialang.org/t/how-to-determine-when-to-broadcast/116127)

<div class="topic-metadata">

**Author:** [@lrennels](https://discourse.julialang.org/u/lrennels)\
**Replies:** 10\
**Last updated:** [June 24, 2024, 2:55am UTC](https://discourse.julialang.org/t/how-to-determine-when-to-broadcast/116127 "2024-06-24T02:55:57Z")

</div>

I have some code that needs to perform a setindex!(A::Array, X::Float64, Indices) using A\[Indices...\] = X or broadcasting A\[Indices...\] .= X. Right now until that is called I don’t know if Indices will be a Vector of In…

---

## [ERROR: LoadError: type DataType has no field Let](https://discourse.julialang.org/t/error-loaderror-type-datatype-has-no-field-let/116116)

<div class="topic-metadata">

**Author:** [@JapaCZECH](https://discourse.julialang.org/u/JapaCZECH)\
**Replies:** 2\
**Last updated:** [June 23, 2024, 6:55pm UTC](https://discourse.julialang.org/t/error-loaderror-type-datatype-has-no-field-let/116116 "2024-06-23T18:55:21Z")

</div>

Hello! I have a problem which I don’t know how to solve. I am making a lexer for my programming language and there is this problem: ERROR: LoadError: type DataType has no field Let Stacktrace: \[1\] getproperty(x::Type, f…

---

## [Julia Crashes Instantly within VSCode](https://discourse.julialang.org/t/julia-crashes-instantly-within-vscode/115992)

<div class="topic-metadata">

**Author:** [@freeman](https://discourse.julialang.org/u/freeman)\
**Replies:** 4\
**Last updated:** [June 21, 2024, 11:47pm UTC](https://discourse.julialang.org/t/julia-crashes-instantly-within-vscode/115992 "2024-06-21T23:47:49Z")

</div>

My Julia is crashing a lot. I use Julia with VSCode and when these crashes happen, the repl window just closes itself so fast that I can’t read it. Is there somewhere where these messages are stored? Otherwise, how would…

---

## [Newbie asking - How do I resolve the error: "ERROR: LoadError: ArgumentError: Package Base does not have Sobol in its dependencies"](https://discourse.julialang.org/t/newbie-asking-how-do-i-resolve-the-error-error-loaderror-argumenterror-package-base-does-not-have-sobol-in-its-dependencies/115976)

<div class="topic-metadata">

**Author:** [@groblercarla](https://discourse.julialang.org/u/groblercarla)\
**Replies:** 9\
**Last updated:** [June 21, 2024, 7:09pm UTC](https://discourse.julialang.org/t/newbie-asking-how-do-i-resolve-the-error-error-loaderror-argumenterror-package-base-does-not-have-sobol-in-its-dependencies/115976 "2024-06-21T19:09:43Z")

</div>

I’m completely new to Julia, and have inherited a julia code project from another researcher. (Yay, Julia!) I’m trying to resolve the environment, but I’m getting an error. Specifically the error says the following: - …

---

## [Seeking explanation of Julia code using map! , BitVector and | operator](https://discourse.julialang.org/t/seeking-explanation-of-julia-code-using-map-bitvector-and-operator/115980)

<div class="topic-metadata">

**Author:** [@oOosys](https://discourse.julialang.org/u/oOosys)\
**Replies:** 1\
**Last updated:** [June 21, 2024, 4:54pm UTC](https://discourse.julialang.org/t/seeking-explanation-of-julia-code-using-map-bitvector-and-operator/115980 "2024-06-21T16:54:22Z")

</div>

~ $ julia \_ \_ \_ \_(\_)\_ | Documentation: https://docs.julialang.org (\_) | (\_) (\_) | \_ \_ \_| |\_ \_\_ \_ | Type "?" for help, "\]?" for Pkg help. | | | | | | |/ \_\` | | | | |\_| |…

---

## [Agents constructor](https://discourse.julialang.org/t/agents-constructor/115941)

<div class="topic-metadata">

**Author:** [@martin\_sanchez](https://discourse.julialang.org/u/martin_sanchez)\
**Replies:** 8\
**Last updated:** [June 21, 2024, 2:09pm UTC](https://discourse.julialang.org/t/agents-constructor/115941 "2024-06-21T14:09:07Z")

</div>

Hi, I have two questions: On the first hand, quite recent videos explaining the use showed a use of the @agents macro as @agents NameAgentType GridAgent{2} begin someField end And when I do this with this synt…

---

## [How to launch a new Julia notebook from command line?](https://discourse.julialang.org/t/how-to-launch-a-new-julia-notebook-from-command-line/115959)

<div class="topic-metadata">

**Author:** [@baqwas](https://discourse.julialang.org/u/baqwas)\
**Replies:** 2\
**Last updated:** [June 21, 2024, 12:19pm UTC](https://discourse.julialang.org/t/how-to-launch-a-new-julia-notebook-from-command-line/115959 "2024-06-21T12:19:39Z")

</div>

I’ve installed Julia and IJulia. I have Jupyter, JupyterLab and venv operational previously in my Ubuntu desktop environment. How do I launch a Julia notebook? Is there a link for dummies like me? Thanks. Regards.

---

## [Installation of InteractiveDynamics](https://discourse.julialang.org/t/installation-of-interactivedynamics/115864)

<div class="topic-metadata">

**Author:** [@martin\_sanchez](https://discourse.julialang.org/u/martin_sanchez)\
**Replies:** 3\
**Last updated:** [June 21, 2024, 7:42am UTC](https://discourse.julialang.org/t/installation-of-interactivedynamics/115864 "2024-06-21T07:42:57Z")

</div>

I tried to run ““add InteractiveDynamics”” and got this errors. Until now I didn’t have probelms adding packages, but I am quite confused by this output. 6 dependencies had output during precompilation: ┌ Formatting │…

---

## [Rasters lib](https://discourse.julialang.org/t/rasters-lib/114576)

<div class="topic-metadata">

**Author:** [@Luiz\_Flavio](https://discourse.julialang.org/u/Luiz_Flavio)\
**Replies:** 7\
**Last updated:** [June 20, 2024, 12:33pm UTC](https://discourse.julialang.org/t/rasters-lib/114576 "2024-06-20T12:33:56Z")

</div>

l: did the following code using raster: using NCDatasets using Plots using Rasters # Caminho para o arquivo NetCDF arquivo\_nc = "/run/media/lufla/Backup\_Lufla/data\_rafael/MONAN\_DIAG\_G\_MOD\_GFS\_2024041500\_2024041909.…

---

## [I'm on step zero on macros](https://discourse.julialang.org/t/im-on-step-zero-on-macros/115955)

<div class="topic-metadata">

**Author:** [@martin\_sanchez](https://discourse.julialang.org/u/martin_sanchez)\
**Replies:** 2\
**Last updated:** [June 21, 2024, 2:43am UTC](https://discourse.julialang.org/t/im-on-step-zero-on-macros/115955 "2024-06-21T02:43:16Z")

</div>

Hi, I have read most of the documentation, and trying to get my head around macros and how to write my own, but I read a thing like this macro css\_str(x::String) kvalues::Vector{SubString} = split(x, ";") Dict…

---

## [Problem with "9 - Julia is fast.ipynb"](https://discourse.julialang.org/t/problem-with-9-julia-is-fast-ipynb/115951)

<div class="topic-metadata">

**Author:** [@watchben](https://discourse.julialang.org/u/watchben)\
**Replies:** 2\
**Last updated:** [June 20, 2024, 8:44pm UTC](https://discourse.julialang.org/t/problem-with-9-julia-is-fast-ipynb/115951 "2024-06-20T20:44:47Z")

</div>

Hello dear community, I downloaded the jupiter notebook file 9 Julia is fast.ipynb about benchmark from intro course (here). When I run the first cell about C language (where it’s supposed to allow writing C in julia e…

---

## [Array of tuples](https://discourse.julialang.org/t/array-of-tuples/11435)

<div class="topic-metadata">

**Author:** [@jcrbloch](https://discourse.julialang.org/u/jcrbloch)\
**Replies:** 17\
**Last updated:** [June 20, 2024, 9:39am UTC](https://discourse.julialang.org/t/array-of-tuples/11435 "2024-06-20T09:39:27Z")

</div>

I have an array A of tuples Array{TupleFloat64,Float64},1}, but am not able to make two arrays out of this like: I1 = A\[:\]\[1\] I2 = A\[:\]\[2 even though I can access the individual elements with A\[i\]\[j\]

---

## [Is it possible to "using" or "import” specific version of a registered package](https://discourse.julialang.org/t/is-it-possible-to-using-or-import-specific-version-of-a-registered-package/115902)

<div class="topic-metadata">

**Author:** [@lionisxn](https://discourse.julialang.org/u/lionisxn)\
**Replies:** 8\
**Last updated:** [June 20, 2024, 7:54am UTC](https://discourse.julialang.org/t/is-it-possible-to-using-or-import-specific-version-of-a-registered-package/115902 "2024-06-20T07:54:27Z")

</div>

I just want to know whether it is possible to “using” or "import” the latest version of a registered package of which the version installed in a local machine is limited to the obsolescence by other installed packages.

---

## [How does Julia compare to shell scripting using bash and its "friends" like bc on a Linux system?](https://discourse.julialang.org/t/how-does-julia-compare-to-shell-scripting-using-bash-and-its-friends-like-bc-on-a-linux-system/115775)

<div class="topic-metadata">

**Author:** [@oOosys](https://discourse.julialang.org/u/oOosys)\
**Replies:** 40\
**Last updated:** [June 19, 2024, 5:55pm UTC](https://discourse.julialang.org/t/how-does-julia-compare-to-shell-scripting-using-bash-and-its-friends-like-bc-on-a-linux-system/115775 "2024-06-19T17:55:57Z")

</div>

There is a well written section of Julia documentation providing comparisons to some of the other programming languages here: https://docs.julialang.org/en/v1/manual/noteworthy-differences What I am missing is comparis…

---

## [Reading and writing to a websocket](https://discourse.julialang.org/t/reading-and-writing-to-a-websocket/114974)

<div class="topic-metadata">

**Author:** [@freeman](https://discourse.julialang.org/u/freeman)\
**Replies:** 1\
**Last updated:** [June 19, 2024, 4:28pm UTC](https://discourse.julialang.org/t/reading-and-writing-to-a-websocket/114974 "2024-06-19T16:28:34Z")

</div>

What is the accepted way to read and write to a websocket? The only option that I’ve found is this \[1\]. The problem with it is not only that it’s obviously “outside” of the HTTP.WebSockets API, but also that does so in …

---

## [Change MeshGrids to Arrays](https://discourse.julialang.org/t/change-meshgrids-to-arrays/115856)

<div class="topic-metadata">

**Author:** [@Cyan](https://discourse.julialang.org/u/Cyan)\
**Replies:** 2\
**Last updated:** [June 19, 2024, 1:28pm UTC](https://discourse.julialang.org/t/change-meshgrids-to-arrays/115856 "2024-06-19T13:28:24Z")

</div>

I have two mesh grid xg =5×5 LazyGrids.GridUR{Int64, 1, 2}: \[1 1 1 1 1; 2 2 2 2 2; 3 3 3 3 3; 4 4 4 4 4; 5 5 5 5 5\] and yg =5×5 LazyGrids.GridUR{Int64, 1, 2}: \[1 1 1 1 1; 2 2 2 2 2; 3…

---

## [Slicing vector into matrix](https://discourse.julialang.org/t/slicing-vector-into-matrix/115844)

<div class="topic-metadata">

**Author:** [@Sahil\_Khan](https://discourse.julialang.org/u/Sahil_Khan)\
**Replies:** 1\
**Last updated:** [June 19, 2024, 9:19am UTC](https://discourse.julialang.org/t/slicing-vector-into-matrix/115844 "2024-06-19T09:19:15Z")

</div>

How to do this ? If there is a function? I have a large vector with repeating numbers after some interval. I want to slice it just like how showed in second output. Thank you :slight\_smile: julia\> a = \[1, 1, 1, 1, 2,…

---

## [How to create adaptive meshes](https://discourse.julialang.org/t/how-to-create-adaptive-meshes/115837)

<div class="topic-metadata">

**Author:** [@Cyan](https://discourse.julialang.org/u/Cyan)\
**Replies:** 0\
**Last updated:** [June 19, 2024, 1:03am UTC](https://discourse.julialang.org/t/how-to-create-adaptive-meshes/115837 "2024-06-19T01:03:23Z")

</div>

I have a gray scale picture, how can I make more points near the bright area and less grid in dark area?

---

## [String broadcasting](https://discourse.julialang.org/t/string-broadcasting/115621)

<div class="topic-metadata">

**Author:** [@martin\_sanchez](https://discourse.julialang.org/u/martin_sanchez)\
**Replies:** 5\
**Last updated:** [June 18, 2024, 9:54pm UTC](https://discourse.julialang.org/t/string-broadcasting/115621 "2024-06-18T21:54:36Z")

</div>

So I was following a tutorial, but I got confused when they showed the following code: vec(string.(\[“x”,“y”\],\[1 2 3 4\])) First, how am I supposed to infer the broadcasting of string given a vector and a matrix will re…

[Previous page](https://discourse.julialang.org/c/first-steps/8.md?page=40)

[Next page](https://discourse.julialang.org/c/first-steps/8.md?page=42)
