Hi all, I am new to Julia and trying to migrate my workflow from MATLAB to Julia. There is package I need to use which is not there in the pkg registry. I had looked up that one can add pkgs to local envs simply by adding their git URLs. The pkg works fine both in a .jl file in VScode/codium and Pluto. To use the same set of pkgs in the Pluto Notebook (located in the same directory as my .jl file), I am using the following block:
begin
import Pkg
Pkg.activate("{path-to-my-project folder}")
Pkg.add("PlutoUI")
end
Checking whether PlutoUI actually gets added to my project via Pkg.Status() tells me that it is indeed added to my env and should be working!
But when I try to use elements like Slider via @bind
it doesn’t work and I instead get the following error
UndefVarError: `Slider` not defined in `Main.var"workspace#86"`
Hint: It looks like two or more modules export different bindings with this name, resulting in ambiguity. Try explicitly importing it from a particular module, or qualifying the name with the module it should come from.
Hint: a global variable of this name may be made accessible by importing Makie in the current active module Main
Hint: a global variable of this name may be made accessible by importing CairoMakie in the current active module Main
Hint: a global variable of this name may be made accessible by importing PlutoUI in the current active module Main
Here is my Pluto Notebook Code for reference (as a new user I can not upload it as a .jl file)
### A Pluto.jl notebook ###
# v0.20.8
using Markdown
using InteractiveUtils
# This Pluto notebook uses @bind for interactivity. When running this notebook outside of Pluto, the following 'mock version' of @bind gives bound variables a default value (instead of an error).
macro bind(def, element)
#! format: off
return quote
local iv = try Base.loaded_modules[Base.PkgId(Base.UUID("6e696c72-6542-2067-7265-42206c756150"), "AbstractPlutoDingetjes")].Bonds.initial_value catch; b -> missing; end
local el = $(esc(element))
global $(esc(def)) = Core.applicable(Base.get, el) ? Base.get(el) : iv(el)
el
end
#! format: on
end
# ╔═╡ d126bd7a-c8fc-4a41-a456-497bd18804e5
begin
import Pkg
Pkg.activate("/home/koustubh/Documents/Analog_IC_Design/AIC_S25/Project")
Pkg.add("PlutoUI")
end
# ╔═╡ 020ca5ce-caf6-494f-acc7-6eb07f6ceed1
using PlutoUI
# ╔═╡ 937172cf-a4d3-48e0-af65-edf4d3cd27e4
begin
using Gm_ID_kit
using CairoMakie
nch = ParseMAT("nmos18_TT_NOM.mat","nmos18_1");
# Plotting GM_ID and fT curves against VGS
L = collect(0.2:0.1:0.5); #in um
VDS = 0.5;
VGS = vec(nch["VGS"]); #in volts
fT = LookUp(nch,"GM_CGG";VDS=VDS,VGS=VGS,L=L)/(2*pi);
gm_id = LookUp(nch,"GM_ID";VDS=VDS,VGS=VGS,L=L);
vth = LookUp(nch,"VT";VDS=VDS,VGS=VGS,L=L);
f1 = Figure()
ax1 = Axis(f1[1,1],ylabel = "gm/ID (s/A)",xlabel= "VGS(V)")
ax2 = Axis(f1[1,1],yscale=log10,yaxisposition= :right,ylabel = "fT (MHz)")
hidexdecorations!(ax2)
hidespines!(ax2)
linkxaxes!(ax1, ax2)
for i in 1:length(L)
fT_plt = fT[i,:,1,1]
lines!(ax2,VGS,fT_plt/1e6,linewidth=2)
gm_id_plt = gm_id[i,:,1,1]
lines!(ax1,VGS,gm_id_plt,linewidth=2)
vth_plt = vth[i,1,1,1]
vlines!(ax1,vth_plt,linestyle=:dash,color=:red)
end
f1
end
# ╔═╡ b2b86931-1d79-44d6-bd88-473111bddbe6
#Verify all the pacakges are loaded correctly
Pkg.status()
# ╔═╡ a8be77f3-5c68-43b5-a9d5-06b7c51c2285
vds = @bind x Slider(0:1.8,default=0.9)
# ╔═╡ 41825102-4aa9-4067-bdfc-51b427079295
print(vth[:,1,1,1])
# ╔═╡ Cell order:
# ╠═d126bd7a-c8fc-4a41-a456-497bd18804e5
# ╠═b2b86931-1d79-44d6-bd88-473111bddbe6
# ╠═020ca5ce-caf6-494f-acc7-6eb07f6ceed1
# ╠═a8be77f3-5c68-43b5-a9d5-06b7c51c2285
# ╠═937172cf-a4d3-48e0-af65-edf4d3cd27e4
# ╠═41825102-4aa9-4067-bdfc-51b427079295