how to fix this roblox script unknown error - roblox

I'm getting a script error in the console saying I need a "}" near line 4.
The fifth parameter there is a error, and idk how to fix it:
local args = {
[1] = game:GetService("Players").LocalPlayer.Character,
[2] = workspace.NPCs["Harlow Auburn"],
[3] = "Ice Magic",
[4] = "3",
[5] = "["Blast Attack",1,90,100,false,"Two Hands","(None)","Blast","Ice","Ice"]",
[6] = 0,
}
game:GetService("ReplicatedStorage").RS.Remotes.Magic.DealAttackDamage:FireServer(unpack(args))

You've got a syntax error.
If [5] is supposed to be a single string, then you need to properly escape your string values :
[5] = "[\"Blast Attack\",1,90,100,false,\"Two Hands\",\"(None)\",\"Blast\",\"Ice\",\"Ice\"]",
If [5] is supposed to be an array of values, then you need to define it as a table.
[5] = {"Blast Attack",1,90,100,false,"Two Hands","(None)","Blast","Ice","Ice"},

Related

Convert Int64 array to Int8 in Julia gives InexactError: trunc(Int8, -9223372036854775808)

I try to convert a part of an julia df from Int64 to Int8.
input:
array = convert(Array{Int8} , array );
output:
InexactError: trunc(Int8, -9223372036854775808)
Stacktrace:
[1] throw_inexacterror(f::Symbol, #unused#::Type{Int8}, val::Int64)
# Core ./boot.jl:612
[2] checked_trunc_sint
# ./boot.jl:634 [inlined]
[3] toInt8
# ./boot.jl:649 [inlined]
[4] Int8
# ./boot.jl:759 [inlined]
[5] convert
# ./number.jl:7 [inlined]
[6] setindex!
# ./array.jl:903 [inlined]
[7] _unsafe_copyto!(dest::Vector{Int8}, doffs::Int64, src::Vector{Int64}, soffs::Int64, n::Int64)
# Base ./array.jl:253
[8] unsafe_copyto!
# ./array.jl:307 [inlined]
[9] _copyto_impl!
# ./array.jl:331 [inlined]
[10] copyto!
# ./array.jl:317 [inlined]
[11] copyto!
# ./array.jl:343 [inlined]
[12] copyto_axcheck!
# ./abstractarray.jl:1104 [inlined]
[13] Vector{Int8}(x::Vector{Int64})
# Base ./array.jl:563
[14] Array
# ./boot.jl:482 [inlined]
[15] convert(#unused#::Type{Array{Int8}}, a::Vector{Int64})
# Base ./array.jl:554
[16] top-level scope
# In[62]:1
[17] eval
# ./boot.jl:373 [inlined]
[18] include_string(mapexpr::typeof(REPL.softscope), mod::Module, code::String, filename::String)
# Base ./loading.jl:1196
Also:
Input:
maximum(array)
output:
11
So the bigges value of this is under 255 which is the max size of Int8.
thanks,
Bene
While the maximum value in your data is 11, the minimum value in your data is -9223372036854775808, also known as typemin(Int64), which cannot be converted to Int8 since that type can only represent values from -128 to 127.
Sometimes the typemin value in the array is used to indicate a null value or a missing value. This isn't the best practice in Julia, but it's possible your data source is using the value this way.
Say you have an array arr:
julia> arr = [1, 2, typemin(Int), 4]
4-element Vector{Int64}:
1
2
-9223372036854775808
4
If the typemin value is supposed to indicate missing data, you can do:
julia> [n == typemin(Int) ? missing : Int8(n) for n in arr]
4-element Vector{Union{Missing, Int8}}:
1
2
missing
4
Or if it's supposed to indicate null/invalid data, you can use nothing instead of missing above.

How do I implement the termination of an ODE solution based on an event in Julia? Why am I getting a BoundsError?

I am trying to solve a coupled ODE using the DifferentialEquations package in Julia, and trying to implement a Continuous Callback to check when a certain variable becomes small enough, so I can terminate the integration. The functions xdot, ddot are defined earlier, and this is working fine without the cb = callback argument.
function w(x,d)
retval = p(x,d)./rho(x,d)
if isnan(retval)
return 0.0
end
return retval
end
function wsys!(dv,v,p,t)
x,d = v
dv[1] = xdot(x,d)
dv[2] = ddot(x,d)
end
function w_enough(t,v,integrator)
w(v[1],v[2]) - 0.0001
end
cb = ContinuousCallback(w_enough,terminate!)
init = [xi,di]
tspan = (0,log(1e4))
prob = ODEProblem(wsys!,init,tspan)
sol = solve(prob,callback=cb);
When I run the last line, I get the error:
BoundsError
Stacktrace:
[1] getindex at .\number.jl:78 [inlined]
[2] w_enough(::Array{Float64,1}, ::Float64, ::OrdinaryDiffEq.ODEIntegrator{CompositeAlgorithm{Tuple{Tsit5,Rosenbrock23{0,false,DefaultLinSolve,DataType}},AutoSwitch{Tsit5,Rosenbrock23{0,false,DefaultLinSolve,DataType},Rational{Int64},Int64}},true,Array{Float64,1},Float64,DiffEqBase.NullParameters,Float64,Float64,Float64,Array{Array{Float64,1},1},OrdinaryDiffEq.ODECompositeSolution{Float64,2,Array{Array{Float64,1},1},Nothing,Nothing,Array{Float64,1},Array{Array{Array{Float64,1},1},1},ODEProblem{Array{Float64,1},Tuple{Float64,Float64},true,DiffEqBase.NullParameters,ODEFunction{true,typeof(wsys!),LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}},DiffEqBase.StandardODEProblem},CompositeAlgorithm{Tuple{Tsit5,Rosenbrock23{0,false,DefaultLinSolve,DataType}},AutoSwitch{Tsit5,Rosenbrock23{0,false,DefaultLinSolve,DataType},Rational{Int64},Int64}},OrdinaryDiffEq.CompositeInterpolationData{ODEFunction{true,typeof(wsys!),LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Array{Array{Float64,1},1},Array{Float64,1},Array{Array{Array{Float64,1},1},1},OrdinaryDiffEq.CompositeCache{Tuple{OrdinaryDiffEq.Tsit5Cache{Array{Float64,1},Array{Float64,1},Array{Float64,1},OrdinaryDiffEq.Tsit5ConstantCache{Float64,Float64}},OrdinaryDiffEq.Rosenbrock23Cache{Array{Float64,1},Array{Float64,1},Array{Float64,1},Array{Float64,2},Array{Float64,2},OrdinaryDiffEq.Rosenbrock23Tableau{Float64},DiffEqBase.TimeGradientWrapper{ODEFunction{true,typeof(wsys!),LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Array{Float64,1},DiffEqBase.NullParameters},DiffEqBase.UJacobianWrapper{ODEFunction{true,typeof(wsys!),LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Float64,DiffEqBase.NullParameters},DefaultLinSolve,FiniteDiff.JacobianCache{Array{Float64,1},Array{Float64,1},Array{Float64,1},UnitRange{Int64},Nothing,Val{:forward},Float64},FiniteDiff.GradientCache{Nothing,Array{Float64,1},Array{Float64,1},Val{:forward},Float64,Val{true}}}},AutoSwitch{Tsit5,Rosenbrock23{0,false,DefaultLinSolve,DataType},Rational{Int64},Int64}}},DiffEqBase.DEStats},ODEFunction{true,typeof(wsys!),LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},OrdinaryDiffEq.CompositeCache{Tuple{OrdinaryDiffEq.Tsit5Cache{Array{Float64,1},Array{Float64,1},Array{Float64,1},OrdinaryDiffEq.Tsit5ConstantCache{Float64,Float64}},OrdinaryDiffEq.Rosenbrock23Cache{Array{Float64,1},Array{Float64,1},Array{Float64,1},Array{Float64,2},Array{Float64,2},OrdinaryDiffEq.Rosenbrock23Tableau{Float64},DiffEqBase.TimeGradientWrapper{ODEFunction{true,typeof(wsys!),LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Array{Float64,1},DiffEqBase.NullParameters},DiffEqBase.UJacobianWrapper{ODEFunction{true,typeof(wsys!),LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Float64,DiffEqBase.NullParameters},DefaultLinSolve,FiniteDiff.JacobianCache{Array{Float64,1},Array{Float64,1},Array{Float64,1},UnitRange{Int64},Nothing,Val{:forward},Float64},FiniteDiff.GradientCache{Nothing,Array{Float64,1},Array{Float64,1},Val{:forward},Float64,Val{true}}}},AutoSwitch{Tsit5,Rosenbrock23{0,false,DefaultLinSolve,DataType},Rational{Int64},Int64}},OrdinaryDiffEq.DEOptions{Float64,Float64,Float64,Float64,typeof(DiffEqBase.ODE_DEFAULT_NORM),typeof(LinearAlgebra.opnorm),CallbackSet{Tuple{ContinuousCallback{typeof(w_enough),typeof(affect!),typeof(affect!),typeof(DiffEqBase.INITIALIZE_DEFAULT),Float64,Int64,Nothing}},Tuple{}},typeof(DiffEqBase.ODE_DEFAULT_ISOUTOFDOMAIN),typeof(DiffEqBase.ODE_DEFAULT_PROG_MESSAGE),typeof(DiffEqBase.ODE_DEFAULT_UNSTABLE_CHECK),DataStructures.BinaryHeap{Float64,DataStructures.LessThan},DataStructures.BinaryHeap{Float64,DataStructures.LessThan},Nothing,Nothing,Int64,Array{Float64,1},Array{Float64,1},Array{Float64,1}},Array{Float64,1},Float64,Nothing}) at .\In[15]:8
[3] find_callback_time(::OrdinaryDiffEq.ODEIntegrator{CompositeAlgorithm{Tuple{Tsit5,Rosenbrock23{0,false,DefaultLinSolve,DataType}},AutoSwitch{Tsit5,Rosenbrock23{0,false,DefaultLinSolve,DataType},Rational{Int64},Int64}},true,Array{Float64,1},Float64,DiffEqBase.NullParameters,Float64,Float64,Float64,Array{Array{Float64,1},1},OrdinaryDiffEq.ODECompositeSolution{Float64,2,Array{Array{Float64,1},1},Nothing,Nothing,Array{Float64,1},Array{Array{Array{Float64,1},1},1},ODEProblem{Array{Float64,1},Tuple{Float64,Float64},true,DiffEqBase.NullParameters,ODEFunction{true,typeof(wsys!),LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}},DiffEqBase.StandardODEProblem},CompositeAlgorithm{Tuple{Tsit5,Rosenbrock23{0,false,DefaultLinSolve,DataType}},AutoSwitch{Tsit5,Rosenbrock23{0,false,DefaultLinSolve,DataType},Rational{Int64},Int64}},OrdinaryDiffEq.CompositeInterpolationData{ODEFunction{true,typeof(wsys!),LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Array{Array{Float64,1},1},Array{Float64,1},Array{Array{Array{Float64,1},1},1},OrdinaryDiffEq.CompositeCache{Tuple{OrdinaryDiffEq.Tsit5Cache{Array{Float64,1},Array{Float64,1},Array{Float64,1},OrdinaryDiffEq.Tsit5ConstantCache{Float64,Float64}},OrdinaryDiffEq.Rosenbrock23Cache{Array{Float64,1},Array{Float64,1},Array{Float64,1},Array{Float64,2},Array{Float64,2},OrdinaryDiffEq.Rosenbrock23Tableau{Float64},DiffEqBase.TimeGradientWrapper{ODEFunction{true,typeof(wsys!),LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Array{Float64,1},DiffEqBase.NullParameters},DiffEqBase.UJacobianWrapper{ODEFunction{true,typeof(wsys!),LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Float64,DiffEqBase.NullParameters},DefaultLinSolve,FiniteDiff.JacobianCache{Array{Float64,1},Array{Float64,1},Array{Float64,1},UnitRange{Int64},Nothing,Val{:forward},Float64},FiniteDiff.GradientCache{Nothing,Array{Float64,1},Array{Float64,1},Val{:forward},Float64,Val{true}}}},AutoSwitch{Tsit5,Rosenbrock23{0,false,DefaultLinSolve,DataType},Rational{Int64},Int64}}},DiffEqBase.DEStats},ODEFunction{true,typeof(wsys!),LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},OrdinaryDiffEq.CompositeCache{Tuple{OrdinaryDiffEq.Tsit5Cache{Array{Float64,1},Array{Float64,1},Array{Float64,1},OrdinaryDiffEq.Tsit5ConstantCache{Float64,Float64}},OrdinaryDiffEq.Rosenbrock23Cache{Array{Float64,1},Array{Float64,1},Array{Float64,1},Array{Float64,2},Array{Float64,2},OrdinaryDiffEq.Rosenbrock23Tableau{Float64},DiffEqBase.TimeGradientWrapper{ODEFunction{true,typeof(wsys!),LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Array{Float64,1},DiffEqBase.NullParameters},DiffEqBase.UJacobianWrapper{ODEFunction{true,typeof(wsys!),LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Float64,DiffEqBase.NullParameters},DefaultLinSolve,FiniteDiff.JacobianCache{Array{Float64,1},Array{Float64,1},Array{Float64,1},UnitRange{Int64},Nothing,Val{:forward},Float64},FiniteDiff.GradientCache{Nothing,Array{Float64,1},Array{Float64,1},Val{:forward},Float64,Val{true}}}},AutoSwitch{Tsit5,Rosenbrock23{0,false,DefaultLinSolve,DataType},Rational{Int64},Int64}},OrdinaryDiffEq.DEOptions{Float64,Float64,Float64,Float64,typeof(DiffEqBase.ODE_DEFAULT_NORM),typeof(LinearAlgebra.opnorm),CallbackSet{Tuple{ContinuousCallback{typeof(w_enough),typeof(affect!),typeof(affect!),typeof(DiffEqBase.INITIALIZE_DEFAULT),Float64,Int64,Nothing}},Tuple{}},typeof(DiffEqBase.ODE_DEFAULT_ISOUTOFDOMAIN),typeof(DiffEqBase.ODE_DEFAULT_PROG_MESSAGE),typeof(DiffEqBase.ODE_DEFAULT_UNSTABLE_CHECK),DataStructures.BinaryHeap{Float64,DataStructures.LessThan},DataStructures.BinaryHeap{Float64,DataStructures.LessThan},Nothing,Nothing,Int64,Array{Float64,1},Array{Float64,1},Array{Float64,1}},Array{Float64,1},Float64,Nothing}, ::ContinuousCallback{typeof(w_enough),typeof(affect!),typeof(affect!),typeof(DiffEqBase.INITIALIZE_DEFAULT),Float64,Int64,Nothing}, ::Int64) at C:\Users\hganj\.julia\packages\DiffEqBase\mDFok\src\callbacks.jl:498
[4] find_first_continuous_callback at C:\Users\hganj\.julia\packages\DiffEqBase\mDFok\src\callbacks.jl:383 [inlined]
[5] handle_callbacks!(::OrdinaryDiffEq.ODEIntegrator{CompositeAlgorithm{Tuple{Tsit5,Rosenbrock23{0,false,DefaultLinSolve,DataType}},AutoSwitch{Tsit5,Rosenbrock23{0,false,DefaultLinSolve,DataType},Rational{Int64},Int64}},true,Array{Float64,1},Float64,DiffEqBase.NullParameters,Float64,Float64,Float64,Array{Array{Float64,1},1},OrdinaryDiffEq.ODECompositeSolution{Float64,2,Array{Array{Float64,1},1},Nothing,Nothing,Array{Float64,1},Array{Array{Array{Float64,1},1},1},ODEProblem{Array{Float64,1},Tuple{Float64,Float64},true,DiffEqBase.NullParameters,ODEFunction{true,typeof(wsys!),LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}},DiffEqBase.StandardODEProblem},CompositeAlgorithm{Tuple{Tsit5,Rosenbrock23{0,false,DefaultLinSolve,DataType}},AutoSwitch{Tsit5,Rosenbrock23{0,false,DefaultLinSolve,DataType},Rational{Int64},Int64}},OrdinaryDiffEq.CompositeInterpolationData{ODEFunction{true,typeof(wsys!),LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Array{Array{Float64,1},1},Array{Float64,1},Array{Array{Array{Float64,1},1},1},OrdinaryDiffEq.CompositeCache{Tuple{OrdinaryDiffEq.Tsit5Cache{Array{Float64,1},Array{Float64,1},Array{Float64,1},OrdinaryDiffEq.Tsit5ConstantCache{Float64,Float64}},OrdinaryDiffEq.Rosenbrock23Cache{Array{Float64,1},Array{Float64,1},Array{Float64,1},Array{Float64,2},Array{Float64,2},OrdinaryDiffEq.Rosenbrock23Tableau{Float64},DiffEqBase.TimeGradientWrapper{ODEFunction{true,typeof(wsys!),LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Array{Float64,1},DiffEqBase.NullParameters},DiffEqBase.UJacobianWrapper{ODEFunction{true,typeof(wsys!),LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Float64,DiffEqBase.NullParameters},DefaultLinSolve,FiniteDiff.JacobianCache{Array{Float64,1},Array{Float64,1},Array{Float64,1},UnitRange{Int64},Nothing,Val{:forward},Float64},FiniteDiff.GradientCache{Nothing,Array{Float64,1},Array{Float64,1},Val{:forward},Float64,Val{true}}}},AutoSwitch{Tsit5,Rosenbrock23{0,false,DefaultLinSolve,DataType},Rational{Int64},Int64}}},DiffEqBase.DEStats},ODEFunction{true,typeof(wsys!),LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},OrdinaryDiffEq.CompositeCache{Tuple{OrdinaryDiffEq.Tsit5Cache{Array{Float64,1},Array{Float64,1},Array{Float64,1},OrdinaryDiffEq.Tsit5ConstantCache{Float64,Float64}},OrdinaryDiffEq.Rosenbrock23Cache{Array{Float64,1},Array{Float64,1},Array{Float64,1},Array{Float64,2},Array{Float64,2},OrdinaryDiffEq.Rosenbrock23Tableau{Float64},DiffEqBase.TimeGradientWrapper{ODEFunction{true,typeof(wsys!),LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Array{Float64,1},DiffEqBase.NullParameters},DiffEqBase.UJacobianWrapper{ODEFunction{true,typeof(wsys!),LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Float64,DiffEqBase.NullParameters},DefaultLinSolve,FiniteDiff.JacobianCache{Array{Float64,1},Array{Float64,1},Array{Float64,1},UnitRange{Int64},Nothing,Val{:forward},Float64},FiniteDiff.GradientCache{Nothing,Array{Float64,1},Array{Float64,1},Val{:forward},Float64,Val{true}}}},AutoSwitch{Tsit5,Rosenbrock23{0,false,DefaultLinSolve,DataType},Rational{Int64},Int64}},OrdinaryDiffEq.DEOptions{Float64,Float64,Float64,Float64,typeof(DiffEqBase.ODE_DEFAULT_NORM),typeof(LinearAlgebra.opnorm),CallbackSet{Tuple{ContinuousCallback{typeof(w_enough),typeof(affect!),typeof(affect!),typeof(DiffEqBase.INITIALIZE_DEFAULT),Float64,Int64,Nothing}},Tuple{}},typeof(DiffEqBase.ODE_DEFAULT_ISOUTOFDOMAIN),typeof(DiffEqBase.ODE_DEFAULT_PROG_MESSAGE),typeof(DiffEqBase.ODE_DEFAULT_UNSTABLE_CHECK),DataStructures.BinaryHeap{Float64,DataStructures.LessThan},DataStructures.BinaryHeap{Float64,DataStructures.LessThan},Nothing,Nothing,Int64,Array{Float64,1},Array{Float64,1},Array{Float64,1}},Array{Float64,1},Float64,Nothing}) at C:\Users\hganj\.julia\packages\OrdinaryDiffEq\8Pn99\src\integrators\integrator_utils.jl:247
[6] _loopfooter!(::OrdinaryDiffEq.ODEIntegrator{CompositeAlgorithm{Tuple{Tsit5,Rosenbrock23{0,false,DefaultLinSolve,DataType}},AutoSwitch{Tsit5,Rosenbrock23{0,false,DefaultLinSolve,DataType},Rational{Int64},Int64}},true,Array{Float64,1},Float64,DiffEqBase.NullParameters,Float64,Float64,Float64,Array{Array{Float64,1},1},OrdinaryDiffEq.ODECompositeSolution{Float64,2,Array{Array{Float64,1},1},Nothing,Nothing,Array{Float64,1},Array{Array{Array{Float64,1},1},1},ODEProblem{Array{Float64,1},Tuple{Float64,Float64},true,DiffEqBase.NullParameters,ODEFunction{true,typeof(wsys!),LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}},DiffEqBase.StandardODEProblem},CompositeAlgorithm{Tuple{Tsit5,Rosenbrock23{0,false,DefaultLinSolve,DataType}},AutoSwitch{Tsit5,Rosenbrock23{0,false,DefaultLinSolve,DataType},Rational{Int64},Int64}},OrdinaryDiffEq.CompositeInterpolationData{ODEFunction{true,typeof(wsys!),LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Array{Array{Float64,1},1},Array{Float64,1},Array{Array{Array{Float64,1},1},1},OrdinaryDiffEq.CompositeCache{Tuple{OrdinaryDiffEq.Tsit5Cache{Array{Float64,1},Array{Float64,1},Array{Float64,1},OrdinaryDiffEq.Tsit5ConstantCache{Float64,Float64}},OrdinaryDiffEq.Rosenbrock23Cache{Array{Float64,1},Array{Float64,1},Array{Float64,1},Array{Float64,2},Array{Float64,2},OrdinaryDiffEq.Rosenbrock23Tableau{Float64},DiffEqBase.TimeGradientWrapper{ODEFunction{true,typeof(wsys!),LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Array{Float64,1},DiffEqBase.NullParameters},DiffEqBase.UJacobianWrapper{ODEFunction{true,typeof(wsys!),LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Float64,DiffEqBase.NullParameters},DefaultLinSolve,FiniteDiff.JacobianCache{Array{Float64,1},Array{Float64,1},Array{Float64,1},UnitRange{Int64},Nothing,Val{:forward},Float64},FiniteDiff.GradientCache{Nothing,Array{Float64,1},Array{Float64,1},Val{:forward},Float64,Val{true}}}},AutoSwitch{Tsit5,Rosenbrock23{0,false,DefaultLinSolve,DataType},Rational{Int64},Int64}}},DiffEqBase.DEStats},ODEFunction{true,typeof(wsys!),LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},OrdinaryDiffEq.CompositeCache{Tuple{OrdinaryDiffEq.Tsit5Cache{Array{Float64,1},Array{Float64,1},Array{Float64,1},OrdinaryDiffEq.Tsit5ConstantCache{Float64,Float64}},OrdinaryDiffEq.Rosenbrock23Cache{Array{Float64,1},Array{Float64,1},Array{Float64,1},Array{Float64,2},Array{Float64,2},OrdinaryDiffEq.Rosenbrock23Tableau{Float64},DiffEqBase.TimeGradientWrapper{ODEFunction{true,typeof(wsys!),LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Array{Float64,1},DiffEqBase.NullParameters},DiffEqBase.UJacobianWrapper{ODEFunction{true,typeof(wsys!),LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Float64,DiffEqBase.NullParameters},DefaultLinSolve,FiniteDiff.JacobianCache{Array{Float64,1},Array{Float64,1},Array{Float64,1},UnitRange{Int64},Nothing,Val{:forward},Float64},FiniteDiff.GradientCache{Nothing,Array{Float64,1},Array{Float64,1},Val{:forward},Float64,Val{true}}}},AutoSwitch{Tsit5,Rosenbrock23{0,false,DefaultLinSolve,DataType},Rational{Int64},Int64}},OrdinaryDiffEq.DEOptions{Float64,Float64,Float64,Float64,typeof(DiffEqBase.ODE_DEFAULT_NORM),typeof(LinearAlgebra.opnorm),CallbackSet{Tuple{ContinuousCallback{typeof(w_enough),typeof(affect!),typeof(affect!),typeof(DiffEqBase.INITIALIZE_DEFAULT),Float64,Int64,Nothing}},Tuple{}},typeof(DiffEqBase.ODE_DEFAULT_ISOUTOFDOMAIN),typeof(DiffEqBase.ODE_DEFAULT_PROG_MESSAGE),typeof(DiffEqBase.ODE_DEFAULT_UNSTABLE_CHECK),DataStructures.BinaryHeap{Float64,DataStructures.LessThan},DataStructures.BinaryHeap{Float64,DataStructures.LessThan},Nothing,Nothing,Int64,Array{Float64,1},Array{Float64,1},Array{Float64,1}},Array{Float64,1},Float64,Nothing}) at C:\Users\hganj\.julia\packages\OrdinaryDiffEq\8Pn99\src\integrators\integrator_utils.jl:202
[7] loopfooter! at C:\Users\hganj\.julia\packages\OrdinaryDiffEq\8Pn99\src\integrators\integrator_utils.jl:166 [inlined]
[8] solve!(::OrdinaryDiffEq.ODEIntegrator{CompositeAlgorithm{Tuple{Tsit5,Rosenbrock23{0,false,DefaultLinSolve,DataType}},AutoSwitch{Tsit5,Rosenbrock23{0,false,DefaultLinSolve,DataType},Rational{Int64},Int64}},true,Array{Float64,1},Float64,DiffEqBase.NullParameters,Float64,Float64,Float64,Array{Array{Float64,1},1},OrdinaryDiffEq.ODECompositeSolution{Float64,2,Array{Array{Float64,1},1},Nothing,Nothing,Array{Float64,1},Array{Array{Array{Float64,1},1},1},ODEProblem{Array{Float64,1},Tuple{Float64,Float64},true,DiffEqBase.NullParameters,ODEFunction{true,typeof(wsys!),LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}},DiffEqBase.StandardODEProblem},CompositeAlgorithm{Tuple{Tsit5,Rosenbrock23{0,false,DefaultLinSolve,DataType}},AutoSwitch{Tsit5,Rosenbrock23{0,false,DefaultLinSolve,DataType},Rational{Int64},Int64}},OrdinaryDiffEq.CompositeInterpolationData{ODEFunction{true,typeof(wsys!),LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Array{Array{Float64,1},1},Array{Float64,1},Array{Array{Array{Float64,1},1},1},OrdinaryDiffEq.CompositeCache{Tuple{OrdinaryDiffEq.Tsit5Cache{Array{Float64,1},Array{Float64,1},Array{Float64,1},OrdinaryDiffEq.Tsit5ConstantCache{Float64,Float64}},OrdinaryDiffEq.Rosenbrock23Cache{Array{Float64,1},Array{Float64,1},Array{Float64,1},Array{Float64,2},Array{Float64,2},OrdinaryDiffEq.Rosenbrock23Tableau{Float64},DiffEqBase.TimeGradientWrapper{ODEFunction{true,typeof(wsys!),LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Array{Float64,1},DiffEqBase.NullParameters},DiffEqBase.UJacobianWrapper{ODEFunction{true,typeof(wsys!),LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Float64,DiffEqBase.NullParameters},DefaultLinSolve,FiniteDiff.JacobianCache{Array{Float64,1},Array{Float64,1},Array{Float64,1},UnitRange{Int64},Nothing,Val{:forward},Float64},FiniteDiff.GradientCache{Nothing,Array{Float64,1},Array{Float64,1},Val{:forward},Float64,Val{true}}}},AutoSwitch{Tsit5,Rosenbrock23{0,false,DefaultLinSolve,DataType},Rational{Int64},Int64}}},DiffEqBase.DEStats},ODEFunction{true,typeof(wsys!),LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},OrdinaryDiffEq.CompositeCache{Tuple{OrdinaryDiffEq.Tsit5Cache{Array{Float64,1},Array{Float64,1},Array{Float64,1},OrdinaryDiffEq.Tsit5ConstantCache{Float64,Float64}},OrdinaryDiffEq.Rosenbrock23Cache{Array{Float64,1},Array{Float64,1},Array{Float64,1},Array{Float64,2},Array{Float64,2},OrdinaryDiffEq.Rosenbrock23Tableau{Float64},DiffEqBase.TimeGradientWrapper{ODEFunction{true,typeof(wsys!),LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Array{Float64,1},DiffEqBase.NullParameters},DiffEqBase.UJacobianWrapper{ODEFunction{true,typeof(wsys!),LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Float64,DiffEqBase.NullParameters},DefaultLinSolve,FiniteDiff.JacobianCache{Array{Float64,1},Array{Float64,1},Array{Float64,1},UnitRange{Int64},Nothing,Val{:forward},Float64},FiniteDiff.GradientCache{Nothing,Array{Float64,1},Array{Float64,1},Val{:forward},Float64,Val{true}}}},AutoSwitch{Tsit5,Rosenbrock23{0,false,DefaultLinSolve,DataType},Rational{Int64},Int64}},OrdinaryDiffEq.DEOptions{Float64,Float64,Float64,Float64,typeof(DiffEqBase.ODE_DEFAULT_NORM),typeof(LinearAlgebra.opnorm),CallbackSet{Tuple{ContinuousCallback{typeof(w_enough),typeof(affect!),typeof(affect!),typeof(DiffEqBase.INITIALIZE_DEFAULT),Float64,Int64,Nothing}},Tuple{}},typeof(DiffEqBase.ODE_DEFAULT_ISOUTOFDOMAIN),typeof(DiffEqBase.ODE_DEFAULT_PROG_MESSAGE),typeof(DiffEqBase.ODE_DEFAULT_UNSTABLE_CHECK),DataStructures.BinaryHeap{Float64,DataStructures.LessThan},DataStructures.BinaryHeap{Float64,DataStructures.LessThan},Nothing,Nothing,Int64,Array{Float64,1},Array{Float64,1},Array{Float64,1}},Array{Float64,1},Float64,Nothing}) at C:\Users\hganj\.julia\packages\OrdinaryDiffEq\8Pn99\src\solve.jl:403
[9] #__solve#328(::Base.Iterators.Pairs{Symbol,Any,Tuple{Symbol,Symbol,Symbol},NamedTuple{(:default_set, :second_time, :callback),Tuple{Bool,Bool,ContinuousCallback{typeof(w_enough),typeof(affect!),typeof(affect!),typeof(DiffEqBase.INITIALIZE_DEFAULT),Float64,Int64,Nothing}}}}, ::typeof(DiffEqBase.__solve), ::ODEProblem{Array{Float64,1},Tuple{Float64,Float64},true,DiffEqBase.NullParameters,ODEFunction{true,typeof(wsys!),LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}},DiffEqBase.StandardODEProblem}, ::CompositeAlgorithm{Tuple{Tsit5,Rosenbrock23{0,false,DefaultLinSolve,DataType}},AutoSwitch{Tsit5,Rosenbrock23{0,false,DefaultLinSolve,DataType},Rational{Int64},Int64}}) at C:\Users\hganj\.julia\packages\OrdinaryDiffEq\8Pn99\src\solve.jl:5
[10] (::DiffEqBase.var"#kw##__solve")(::NamedTuple{(:default_set, :second_time, :callback),Tuple{Bool,Bool,ContinuousCallback{typeof(w_enough),typeof(affect!),typeof(affect!),typeof(DiffEqBase.INITIALIZE_DEFAULT),Float64,Int64,Nothing}}}, ::typeof(DiffEqBase.__solve), ::ODEProblem{Array{Float64,1},Tuple{Float64,Float64},true,DiffEqBase.NullParameters,ODEFunction{true,typeof(wsys!),LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}},DiffEqBase.StandardODEProblem}, ::CompositeAlgorithm{Tuple{Tsit5,Rosenbrock23{0,false,DefaultLinSolve,DataType}},AutoSwitch{Tsit5,Rosenbrock23{0,false,DefaultLinSolve,DataType},Rational{Int64},Int64}}) at .\none:0
[11] #__solve#1(::Bool, ::Base.Iterators.Pairs{Symbol,Any,Tuple{Symbol,Symbol},NamedTuple{(:second_time, :callback),Tuple{Bool,ContinuousCallback{typeof(w_enough),typeof(affect!),typeof(affect!),typeof(DiffEqBase.INITIALIZE_DEFAULT),Float64,Int64,Nothing}}}}, ::typeof(DiffEqBase.__solve), ::ODEProblem{Array{Float64,1},Tuple{Float64,Float64},true,DiffEqBase.NullParameters,ODEFunction{true,typeof(wsys!),LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}},DiffEqBase.StandardODEProblem}, ::Nothing) at C:\Users\hganj\.julia\packages\DifferentialEquations\hc2aQ\src\default_solve.jl:7
[12] #__solve at .\none:0 [inlined]
[13] #__solve#448 at C:\Users\hganj\.julia\packages\DiffEqBase\mDFok\src\solve.jl:185 [inlined]
[14] #__solve at .\none:0 [inlined]
[15] #solve_call#443(::Bool, ::Base.Iterators.Pairs{Symbol,ContinuousCallback{typeof(w_enough),typeof(affect!),typeof(affect!),typeof(DiffEqBase.INITIALIZE_DEFAULT),Float64,Int64,Nothing},Tuple{Symbol},NamedTuple{(:callback,),Tuple{ContinuousCallback{typeof(w_enough),typeof(affect!),typeof(affect!),typeof(DiffEqBase.INITIALIZE_DEFAULT),Float64,Int64,Nothing}}}}, ::typeof(DiffEqBase.solve_call), ::ODEProblem{Array{Float64,1},Tuple{Float64,Float64},true,DiffEqBase.NullParameters,ODEFunction{true,typeof(wsys!),LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}},DiffEqBase.StandardODEProblem}) at C:\Users\hganj\.julia\packages\DiffEqBase\mDFok\src\solve.jl:44
[16] #solve_call at .\none:0 [inlined]
[17] #solve#444 at C:\Users\hganj\.julia\packages\DiffEqBase\mDFok\src\solve.jl:67 [inlined]
[18] (::DiffEqBase.var"#kw##solve")(::NamedTuple{(:callback,),Tuple{ContinuousCallback{typeof(w_enough),typeof(affect!),typeof(affect!),typeof(DiffEqBase.INITIALIZE_DEFAULT),Float64,Int64,Nothing}}}, ::typeof(solve), ::ODEProblem{Array{Float64,1},Tuple{Float64,Float64},true,DiffEqBase.NullParameters,ODEFunction{true,typeof(wsys!),LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}},DiffEqBase.StandardODEProblem}) at .\none:0
[19] top-level scope at In[21]:1
Terminating at this event is important to this code, and I'm new to Julia. I'd really appreciate any help!
function w_enough(t,v,integrator)
w(v[1],v[2]) - 0.0001
end
is the incorrect argument ordering, the function as documented should be:
function w_enough(v,t,integrator)
w(v[1],v[2]) - 0.0001
end

Need modification to existing multiline Perl replacement code [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 5 years ago.
Improve this question
I had a recent question earlier this month which was solved by #jm666 which involved multi line text replacement.
I have an issue in that, although this works perfectly as requested, it results in the removal of some text at the very end of the text file which I need to retain.
The line added to my process file which strips the blocks of text is below:
$contents = join '', grep { !/Layer\s*=\s*7\b/ } split /^(?=CHARTS)/m, $contents;
The data below shows what is being stripped. Each block of text commences with CHARTS and ends with [28]=0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
There is then a blank line and we are on to the next block, which again commences with CHARTS.
The line shown at the start of the question correctly strips each entire block (from start to finish) where Layer=7, which is in the 4th line of each block.
The very last block in the file is then followed by some information which formats things. That information commences with STACK. Below the sample code below I show that STACK info.
I have posted a 2 min video which describes the issue in detail
CHARTS
Position=574,1988,1013,2652,-1,-1
Color=14671839
Layer=7
[0] Font=MS SAN SERIF,10,0,F,F,
[1] Show=F,F,F,T,T,F,T,F,F,T,
[2] Scale=F,F,T,F,F,F,F,F,0,T,F,
[3] Grid=F,F,F,F,1,
[4] Paint=F,F,F,0,0,0,
[5] Bars=1,2000,1970,
[6] Colors=65793,0,0,8388608,32767,65793,0,0,
[7] Theme=6,0,255,65280,7566080,0,16777215,0,
[8] Candles=F,F,F,F,1,F,
[9] Filter=T,F,F,F,F,0,0
[10] Type=F,F,F,F,15,5083,
[11] Spacing=5,236,0,10,4,-7,73,
[12] Range=227.8,107.2,2.05,0.01
[13] Volume=0,100,0,0,0,0,
[14] Refresh=0,0,0,
[15] Feed=5,5,F,
[16] Template=
[17] Symbol=#OJ#.W
[18] SubSizes=0,0,0,0,0,0,0,0,0,0,
[19]= <<< Andrews Pitchfork 1 >>>
[20]=61,5085,0,1,192,0,0,0,0,0,0,0,0,0,0,0,0,
[21]=16711935,16711935,16711935,255,16711935,255,16711935,16711935,65793,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
[22]=2,7,0,0,0,64.58475,226.99976,97.1011,35,2,0,0,25,38.2,50,61.8,75,100,0,0,0,0,0,0,0,0,
[23]=146,0,0,2,1120518,0,1120127,255,1090220,1,3,3,1,1,4,1,1,3,1,1,1,0,0,0,0,
[24]=0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
[25]=0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
[26]=0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
[27]=0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
[28]=0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
[19]= <<< c:\XXXXX\Alerts\AUD.wav 103.47 672.59 >>>
[20]=65,5088,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,
[21]=65280,65280,8421376,0,255,255,16711680,16711680,65280,16744447,32767,0,0,0,0,0,0,0,0,0,0,0,0,0,
[22]=0,0,0,0,2730.6001,103.47184,672.59155,103.47184,5,0,0,0,0,0,0,1,0,0.1,0,0,0,0,0,0,0,0,
[23]=3,0,0,0,1120914,0,1170120,255,1120914,1,5,5,1,0,1,1,1,1,1,1,1,0,0,0,0,
[24]=0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,26,99,58,92,69,110,115,105,103,110,49,
[25]=48,92,65,108,101,114,116,115,92,65,85,68,46,119,97,118,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
[26]=0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
[27]=0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
[28]=0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
[19]= <<< Line t 160.65 729.77 >>>
[20]=65,5089,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
[21]=16711935,16711680,8421376,0,255,255,16711680,16711680,65280,16744447,32767,0,0,0,0,0,0,0,0,0,0,0,0,0,
[22]=0,0,0,0,2892.6001,160.65494,729.77466,160.65494,5,0,0,0,0,0,0,1,0,0.1,0,0,0,0,0,0,0,0,
[23]=1,0,0,0,1151023,0,1170120,255,1151023,1,2,2,1,0,1,1,1,1,1,1,1,0,0,0,0,
[24]=0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
[25]=0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
[26]=0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
[27]=0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
[28]=0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
CHARTS
Position=-462,3460,-23,4124,-1,-1
Color=14671839
Layer=1
[0] Font=MS SAN SERIF,10,0,F,F,
[1] Show=F,F,F,T,T,F,T,F,F,T,
[2] Scale=F,F,T,F,F,F,F,F,0,T,F,
[3] Grid=F,F,F,F,1,
[4] Paint=F,F,F,0,0,0,
[5] Bars=1,2000,1970,
[6] Colors=65793,0,0,8388608,32767,65793,0,0,
[7] Theme=6,0,255,65280,7566080,0,16777215,0,
[8] Candles=F,F,F,F,1,F,
[9] Filter=T,F,F,F,F,0,0
[10] Type=F,F,F,F,15,43286,
[11] Spacing=5,183,0,10,4,-7,73,
[12] Range=148.5,89.1,0.01,0.01
[13] Volume=0,100,0,0,0,0,
[14] Refresh=0,0,0,
[15] Feed=5,2,F,
[16] Template=
[17] Symbol=SVXY.D
[18] SubSizes=0,0,0,0,0,0,0,0,0,0,
[19]= <<< Circle >>>
[20]=62,43296,0,0,576,0,0,0,0,0,0,0,0,0,0,0,0,
[21]=13959167,16711680,65280,255,255,5242880,16744192,12900,255,5242880,16727871,0,0,0,0,0,0,0,0,0,0,0,0,0,
[22]=2,7,0,0,-0.28571,134.64,135.71358,134.62071,15,0,0,0,25,38.2,50,61.8,75,100,150,161.8,200,0,0,0,0,0,
[23]=130,2,0,2,1170222,1,1170222,1,1170215,0,2,0,1,1,1,1,1,3,1,1,1,0,0,0,0,
[24]=176,0,0,0,0,0,0,0,0,0,0,177,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,250,25,0,117,4,119,0,216,250,25,
[25]=0,64,202,15,5,4,182,73,0,168,233,105,179,2,0,0,0,117,4,119,0,176,120,64,0,64,202,15,5,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
[26]=0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
[27]=0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
[28]=0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
[19]= <<< Circle >>>
[20]=62,43297,0,0,576,0,0,0,0,0,0,0,0,0,0,0,0,
[21]=13959167,16711680,65280,255,255,5242880,16744192,12900,255,5242880,16727871,0,0,0,0,0,0,0,0,0,0,0,0,0,
[22]=2,7,1.85714,-0.14286,1.57143,145.22144,146.31429,145.22144,15,0,0,0,25,38.2,50,61.8,75,100,150,161.8,200,0,0,0,0,0,
[23]=130,2,0,2,1170323,1,1170323,1,1170321,0,2,0,1,1,1,1,1,3,1,1,1,0,0,0,0,
[24]=176,0,0,0,0,0,0,0,0,0,0,177,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,250,25,0,117,4,119,0,216,250,25,
[25]=0,64,202,15,5,4,182,73,0,168,233,105,179,2,0,0,0,117,4,119,0,176,120,64,0,64,202,15,5,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
[26]=0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
[27]=0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
[28]=0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
[19]= <<< Circle >>>
[20]=62,44362,0,0,576,0,0,0,0,0,0,0,0,0,0,0,0,
[21]=13959167,16711680,65280,255,255,5242880,16744192,12900,255,5242880,16727871,0,0,0,0,0,0,0,0,0,0,0,0,0,
[22]=2,7,0.09091,0,0.09091,63.96,63.93712,63.93712,15,0,0,0,25,38.2,50,61.8,75,100,150,161.8,200,0,0,0,0,0,
[23]=130,2,0,2,1161108,1,1161108,1,1161104,0,2,0,1,1,1,1,1,3,1,1,1,0,0,0,0,
[24]=176,0,0,0,0,0,0,0,0,0,0,177,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,250,25,0,123,2,159,3,216,250,25,
[25]=0,64,202,15,5,4,182,73,0,168,233,105,179,2,0,0,0,123,2,159,3,176,120,64,0,64,202,15,5,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
[26]=0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
[27]=0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
[28]=0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
So, here below is the problem area. The first two lines below are the final two lines of the last block of CHARTS data in the file. As you can see, it is then followed by many smaller blocks which commence with STACK.
This question is simply looking for a modification to the line of code at the start of the question, replicated once more below, to not strip out the STACK blocks. Using the current solution it does remove all the Layer=7 blocks but it also removes all of the STACK blocks at the end of the file. This is despite the final block of text prior to the STACK blocks being Layer=1, not Layer=7.
$contents = join '', grep { !/Layer\s*=\s*7\b/ } split /^(?=CHARTS)/m, $contents;
[27]=0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
[28]=0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
STACK
Position=399,390,888,1211,0,1048
Color=-16777201
Layer=6
ID=56729,56730,56731,56732,56733,56734,56735,
[1] Name=
[2] Index=1,
[3] Pinned=F,
[4] Font=8,-16777208,F,MS SANS SERIF
Window=Minimized
STACK
Position=399,684,888,1348,0,1048
Color=-16777201
Layer=1
ID=28487,9939,
[1] Name=
[2] Index=0,
[3] Pinned=F,
[4] Font=8,-16777208,F,MS SANS SERIF
Window=Minimized
STACK
Provided STACK blocks does only occur at the end of the file, you can try to also split out the STACK blocks:
$contents = join '', grep { /^STACK/ || !/Layer\s*=\s*7\b/ } split /^(?=CHARTS|STACK)/m, $contents;

How to merge numerical cell and char cell of binary values into 1 cell in matlab

I have a matlab cell of 7395X28 numerical values and i have a another character cell of 7395x8 in which there are binary values. I want the binary values cell merged into this numerical value cell without change.
For example let numerical cell be A and binary cell B i merged them like this
C=[A,B]
This gives me a error saying you cannot merge a character cell with numerical values cell. Please anybody help me with this how to solve
The output should be a merged cell and the last column of the cell should consist of binary values. Please help.
Code
a1 = num2cell(randi(5,2,3)) %%// cell array of numerical values
a2 = {'0' '1' '1'; '0' '1' '0' } %%// cell array of characters that are binary numbers
out = num2cell(cell2mat(a1)*10+cell2mat(a2)-'0')
Output
a1 =
[4] [3] [5]
[2] [4] [5]
a2 =
'0' '1' '1'
'0' '1' '0'
out =
[40] [31] [51]
[20] [41] [50]
Edit 1:
Code
A={1,2,3;
2,3,4;
4,5,6;
7,8,9;
0,9,9}
B={'0001'; '0011'; '0111' ;'1111' ;'0101'}
C = [A cellstr(cell2mat(B))]
Output
C =
[1] [2] [3] '0001'
[2] [3] [4] '0011'
[4] [5] [6] '0111'
[7] [8] [9] '1111'
[0] [9] [9] '0101'
Edit 2:
Code
A={1,2,3;
2,3,4;
4,5,6;
7,8,9;
0,9,9}
B = ['00000001';'00010001';'00000001';'10110001';'01010011']
C = [A cellstr(B)]
Output
C =
[1] [2] [3] '00000001'
[2] [3] [4] '00010001'
[4] [5] [6] '00000001'
[7] [8] [9] '10110001'
[0] [9] [9] '01010011'

What cmdlets use the IHostUISupportsMultipleChoiceSelection interface to prompt for choices?

I don't remember ever being prompted for multiple selections before in PowerShell, but I've seen several examples of hosts implementing this interface. Unfortunately, those are the only references I've seen to the interface. I've never seen "here's how to test that you're implementing it correctly".
Please, disregard my first answer; it is not an answer at all, as I can see now. And thank you for a really interesting question.
I still do not know cmdlets that use that interface. But we can use it on our own from scripts. Let's modify the mentioned Get-Choice.ps1 and call the new one Get-Choice2.ps1:
<#
.SYNOPSIS
Displays PowerShell style menu and gets user choices
.DESCRIPTION
*) Returns choice indexes.
*) Choice keys are indicated by '&' in menu items.
*) Help strings can be empty or nulls (items are used themselves).
#>
param
(
# Menu caption
[string]$Caption = 'Confirm',
# Menu message
[string]$Message = 'Are you sure you want to continue?',
# Choice info pairs: item1, help1, item2, help2, ...
[string[]]$Choices = ('&Yes', 'Continue', '&No', 'Stop'),
# Default choice indexes (i.e. selected on [Enter])
[int[]]$DefaultChoice = #(0)
)
if ($args) { throw "Unknown parameters: $args" }
if ($Choices.Count % 2) { throw "Choice count must be even." }
$descriptions = #()
for($i = 0; $i -lt $Choices.Count; $i += 2) {
$c = [System.Management.Automation.Host.ChoiceDescription]$Choices[$i]
$c.HelpMessage = $Choices[$i + 1]
if (!$c.HelpMessage) {
$c.HelpMessage = $Choices[$i].Replace('&', '')
}
$descriptions += $c
}
$Host.UI.PromptForChoice($Caption, $Message, [System.Management.Automation.Host.ChoiceDescription[]]$descriptions, $DefaultChoice)
Now we test it:
Get-Choice2 'Title' 'Message' -DefaultChoice 0, 1, 2 -Choices #(
'Choice &1', 'This is choice 1'
'Choice &2', ''
'Choice &3', ''
'Choice &4', ''
'Choice &5', ''
'Choice &6', ''
'Choice &7', ''
'Choice &8', ''
'Choice &9', ''
'Choice &0', ''
)
It prints 10 choices, the first 3 are highlighted (in the console host), and prompts:
0> Test-Get-Choice2.ps1
Title
Message
[1] Choice 1
[2] Choice 2
[3] Choice 3
[4] Choice 4
[5] Choice 5
[6] Choice 6
[7] Choice 7
[8] Choice 8
[9] Choice 9
[0] Choice 0
[?] Help
(default choices are 1,2,3)
Choice[0]:
If we press Enter immediately the output is the default 3 indexes: 0, 1, 2. If we type, for example: 5 + Enter + 3 + Enter + 1 + Enter + Enter then the output is 4, 2, 0.
It works. PowerShell ISE also supports this but the UI might be something better in GUI version, perhaps.
For example: the command Remove-Item C:\TEMP\Test prompts you to choose:
Confirm
The item at C:\TEMP\Test has children and the Recurse parameter was not specified. If you continue, all children will be removed with the item. Are you sure you want to continue?
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"):
Or you can build your own call using this script (or its idea):
Get-Choice.ps1 - Displays PowerShell style menu and gets a user choice