How to disable the output of set command in matlab Command Window? - matlab

I am trying to set a property of graphics object and when I execute my code, I am getting the list of properties of that graphics object. I tried to add semicolon in the end of set command but it is not helping me. Is there a way to avoid getting output of set command in command window?
BackgroundColor
Color
DisplayName
EdgeColor
Editing: [ on | off ]
FontAngle: [ {normal} | italic | oblique ]
FontName
FontSize
FontUnits: [ inches | centimeters | normalized | {points} | pixels ]
FontWeight: [ light | {normal} | demi | bold ]
HorizontalAlignment: [ {left} | center | right ]
LineStyle: [ {-} | -- | : | -. | none ]
LineWidth
Margin
Position
Rotation
String
Units: [ inches | centimeters | normalized | points | pixels | characters | {data} ]
Interpreter: [ latex | {tex} | none ]
VerticalAlignment: [ top | cap | {middle} | baseline | bottom ]
ButtonDownFcn: string -or- function handle -or- cell array
Children
Clipping: [ {on} | off ]
CreateFcn: string -or- function handle -or- cell array
DeleteFcn: string -or- function handle -or- cell array
BusyAction: [ {queue} | cancel ]
HandleVisibility: [ {on} | callback | off ]
HitTest: [ {on} | off ]
Interruptible: [ {on} | off ]
Parent
Selected: [ on | off ]
SelectionHighlight: [ {on} | off ]
Tag
UIContextMenu
UserData
Visible: [ {on} | off ]
I want to avoid getting this output in command window. I am using following code:
p = mtit ('Global Title') ;
set (p) ;
mtit is method found on Matlab Central FileExchange in order to display the common Title for subplots.

The command set(p) does not set any property of p. The correct syntax for actually setting a property of p is
set( p, 'PropertyName', Value )
When typing only set(p) you get all property-value information typed out (which you don't want)...

Related

altair bar chart for grouped data sorting NOT working

`Reservation_branch_code | ON_ACCOUNT | Rcount
:-------------------------------------------------:
0 1101 | 170 | 5484
1 1103 | 101 | 5111
2 1118 | 1 | 232
3 1121 | 0 | 27
4 1126 | 90 | 191`
would like to chart sorted by "Rcount" and x axis is "Reservation_branch_code"
this below code gives me chart without Sorting by Rcount
base =alt.Chart(df1).transform_fold(
['Rcount', 'ON_ACCOUNT'],
as_=['column', 'value']
)
bars = base.mark_bar().encode(
# x='Reservation_branch_code:N',
x='Reservation_branch_code:O',
y=alt.Y('value:Q', stack=None), # stack =None enables layered bar
color=alt.Color('column:N', scale=alt.Scale(range=["#f50520", "#bab6b7"])),
tooltip=alt.Tooltip(['ON_ACCOUNT','Rcount']),
#order=alt.Order('value:Q')
)
text = base.mark_text(
align='center',
color='black',
baseline='middle',
dx=0,dy=-8, # Nudges text to right so it doesn't appear on top of the bar
).encode(
x='Reservation_branch_code:N',
y='value:Q',
text=alt.Text('value:Q', format='.0f')
)
rule = alt.Chart(df1).mark_rule(color='blue').encode(
y='mean(Rcount):Q'
)
(bars+text+rule).properties(width=790,height=330)
i sorted data in dataframe...used in that df in altair chart
but not found X axis is not sorted by Rcount column........Thanks
You can pass a list with the sort order:
import altair as alt
from vega_datasets import data
source = data.barley()
alt.Chart(source).mark_bar().encode(
x='sum(yield):Q',
y=alt.Y('site:N', sort=source['site'].unique().tolist())
)

Yocto(Zeus) Perf Build fails

I want to build perf on Yocto (Zeus branch), for an image without python2. The recipe is this one:
https://git.yoctoproject.org/cgit/cgit.cgi/poky/tree/meta/recipes-kernel/perf/perf.bb?h=zeus-22.0.4
Running this recipe yields this error:
| ERROR: Execution of '/home/yocto/poseidon-build/tmp/work/imx6dl_poseidon_revb-poseidon-linux-gnueabi/perf/1.0-r9/temp/run.do_compile.19113' failed with exit code 1:
| make: Entering directory '/home/yocto/poseidon-build/tmp/work/imx6dl_poseidon_revb-poseidon-linux-gnueabi/perf/1.0-r9/perf-1.0/tools/perf'
| BUILD: Doing 'make -j4' parallel build
| Warning: arch/x86/include/asm/disabled-features.h differs from kernel
| Warning: arch/x86/include/asm/required-features.h differs from kernel
| Warning: arch/x86/include/asm/cpufeatures.h differs from kernel
| Warning: arch/arm/include/uapi/asm/perf_regs.h differs from kernel
| Warning: arch/arm64/include/uapi/asm/perf_regs.h differs from kernel
| Warning: arch/powerpc/include/uapi/asm/perf_regs.h differs from kernel
| Warning: arch/x86/include/uapi/asm/perf_regs.h differs from kernel
| Warning: arch/x86/include/uapi/asm/kvm.h differs from kernel
| Warning: arch/x86/include/uapi/asm/kvm_perf.h differs from kernel
| Warning: arch/x86/include/uapi/asm/svm.h differs from kernel
| Warning: arch/x86/include/uapi/asm/vmx.h differs from kernel
| Warning: arch/powerpc/include/uapi/asm/kvm.h differs from kernel
| Warning: arch/s390/include/uapi/asm/kvm.h differs from kernel
| Warning: arch/s390/include/uapi/asm/kvm_perf.h differs from kernel
| Warning: arch/s390/include/uapi/asm/sie.h differs from kernel
| Warning: arch/arm/include/uapi/asm/kvm.h differs from kernel
| Warning: arch/arm64/include/uapi/asm/kvm.h differs from kernel
| Warning: arch/x86/lib/memcpy_64.S differs from kernel
| Warning: arch/x86/lib/memset_64.S differs from kernel
|
| Auto-detecting system features:
| ... dwarf: [ on ]
| ... dwarf_getlocations: [ on ]
| ... glibc: [ on ]
| ... gtk2: [ OFF ]
| ... libaudit: [ OFF ]
| ... libbfd: [ on ]
| ... libelf: [ on ]
| ... libnuma: [ OFF ]
| ... numa_num_possible_cpus: [ OFF ]
| ... libperl: [ OFF ]
| ... libpython: [ on ]
| ... libslang: [ on ]
| ... libcrypto: [ on ]
| ... libunwind: [ on ]
| ... libdw-dwarf-unwind: [ on ]
| ... zlib: [ on ]
| ... lzma: [ on ]
| ... get_cpuid: [ OFF ]
| ... bpf: [ on ]
|
| Makefile.config:352: DWARF support is off, BPF prologue is disabled
| Makefile.config:547: Missing perl devel files. Disabling perl scripting support, please install perl-ExtUtils-Embed/libperl-dev
| Makefile.config:594: Python 3 is not yet supported; please set
| Makefile.config:595: PYTHON and/or PYTHON_CONFIG appropriately.
| Makefile.config:596: If you also have Python 2 installed, then
| Makefile.config:597: try something like:
| Makefile.config:598:
| Makefile.config:599: make PYTHON=python2
| Makefile.config:600:
| Makefile.config:601: Otherwise, disable Python support entirely:
| Makefile.config:602:
| Makefile.config:603: make NO_LIBPYTHON=1
| Makefile.config:604:
| Makefile.config:605: *** . Stop.
| Makefile.perf:205: recipe for target 'sub-make' failed
| make[1]: *** [sub-make] Error 2
| Makefile:68: recipe for target 'all' failed
| make: *** [all] Error 2
| make: Leaving directory '/home/yocto/poseidon-build/tmp/work/imx6dl_poseidon_revb-poseidon-linux-gnueabi/perf/1.0-r9/perf-1.0/tools/perf'
| WARNING: exit code 1 from a shell command.
|
ERROR: Task (/home/yocto/sources/poky/meta/recipes-kernel/perf/perf.bb:do_compile) failed with exit code '1'
NOTE: Tasks Summary: Attempted 1947 tasks of which 1946 didn't need to be rerun and 1 failed.
Looking at the recipe, libpython seems to be set?:
PACKAGECONFIG ??= "scripting tui libunwind"
PACKAGECONFIG[dwarf] = ",NO_DWARF=1"
PACKAGECONFIG[scripting] = ",NO_LIBPERL=1 NO_LIBPYTHON=1,perl python3"
# gui support was added with kernel 3.6.35
# since 3.10 libnewt was replaced by slang
# to cover a wide range of kernel we add both dependencies
PACKAGECONFIG[tui] = ",NO_NEWT=1,libnewt slang"
PACKAGECONFIG[libunwind] = ",NO_LIBUNWIND=1 NO_LIBDW_DWARF_UNWIND=1,libunwind"
PACKAGECONFIG[libnuma] = ",NO_LIBNUMA=1"
PACKAGECONFIG[systemtap] = ",NO_SDT=1,systemtap"
PACKAGECONFIG[jvmti] = ",NO_JVMTI=1"
# libaudit support would need scripting to be enabled
PACKAGECONFIG[audit] = ",NO_LIBAUDIT=1,audit"
PACKAGECONFIG[manpages] = ",,xmlto-native asciidoc-native"
Why does it not pick up the flag?
PACKAGECONFIG has scripting in it by default.
PACKAGECONFIG options are defined as following:
PACKAGECONFIG[f1] = "--with-f1, \
--without-f1, \
build-deps-for-f1, \
runtime-deps-for-f1, \
runtime-recommends-for-f1, \
packageconfig-conflicts-for-f1 \
"
PACKAGECONFIG[scripting] is set to ",NO_LIBPERL=1 NO_LIBPYTHON=1,perl python3". See the first comma here? It means that what is defined after is when scripting is not selected.
So if you do not want python dependency to be pulled, just set PACKAGECONFIG to a value without scripting in it.
Though I'm actually surprised the default does not build, that's definitely something that is tested by autobuilders. There's probably something else going on?
c.f.: https://www.yoctoproject.org/docs/latest/mega-manual/mega-manual.html#var-PACKAGECONFIG

Exterior shell of polygon is invalid

i tried to run this mongodb query
db.building.update( { "_id":ObjectId("53041776a2de55000079b4ba") },
{ $set :
{"geometry":{"type":"Polygon","coordinates":[[[127.357858169667,36.36773567198263],[127.35825816966712,36.36773567198263],[127.35805432178199,36.3675356722397],[127.35825816966712,36.36733567198263],[127.357858169667,36.36733567198263],[127.357858169667,36.36773567198263],[127.357858169667,36.36773567198263]]]}}
}
)
result is
Exterior shell of polygon is invalid: { type: "Polygon", coordinates: [ [ [ 127.357858169667, 36.36773567198263 ], [ 127.3582581696671, 36.36773567198263 ], [ 127.358054321782, 36.3675356722397 ], [ 127.3582581696671, 36.36733567198263 ], [ 127.357858169667, 36.36733567198263 ], [ 127.357858169667, 36.36773567198263 ], [ 127.357858169667, 36.36773567198263 ] ] ] }
but GeoJSONLint test is a valid.
help me pls. thank you.
This error will occur if the polygon is malformed, for example:
coordinates are duplicates (the first and last coordinates have to be the same)
1/2 duplicate:
1/2-----3
| |
| |
| |
| |
| |
| |
0------4
if the lines of the polygon intersect each other (e.g. while trying to draw a pentagram)
intersection:
1 3
|\ /|
| \ / |
| \/ |
| /\ |
| / \ |
|/ \|
0/4 2
Duplicates are easy to detect, just check whether the first and last coordinate are are equal and remove one of them.
If you have an intersection in your polygon you can try and reorder the points (similar question: MongoDB Error: Exterior shell of polygon is invalid?).
If this dosen't work check if the GeoJSON is valid (from this question: Why is the exterior shell of this GeoJSON invalid?).

PowerShell Script Starts Adding Blank Lines After 100+ Lines of Output?

I seem to have encountered a weird bug, or I've missed something in my script.
In my scripts, I'm showing progress with a faux progress bar function. It works by updating the same line of the console repeatedly, mimicking a progress bar. See the function below:
# Update-Progress-Bar : v1.0 : 2013-07-29
# Displays a percentage bar. Meant to be used repeatedly to update the same console line (giving the appearance of incrementing progress).
# - $Percentage : Determines how much progress is shown on the bar.
# - $Message : The message that accompanies the progress bar.
function Update-Progress-Bar ($Percentage, $Message){
# Save the current cursor position so we can come back later.
$CursorPosition = $Host.UI.RawUI.CursorPosition
# Convert the percentage into a proper progress bar.
$ProgressBarMax = "20"
$ProgressBarCount = [Math]::Floor([Decimal]($Percentage / 5))
$ProgressBar = ("#" * $ProgressBarCount) + (" " * ($ProgressBarMax - $ProgressBarCount))
# Change the format of the percentage depending on length.
switch ($Percentage.Length){
1 {$Percentage = " " + $Percentage + "%"}
2 {$Percentage = " " + $Percentage + "%"}
default {$Percentage = $Percentage + "%"}
}
# Trim or pad the message as necessary.
$MessageMaxLength = "50"
if ($Message.Length -gt $MessageMaxLength){ $Message = $Message.Remove($MessageMaxLength) }
else { $Message = $Message + (" " * ($MessageMaxLength - $Message.Length)) }
# Display our progress bar, percentage, and message.
Write-Host -nonewline -ForeGroundColor Blue "[$ProgressBar] $Percentage"
Write-Host " | $Message"
# Revert back to the original cursor position.
$Host.UI.RawUI.CursorPosition = $CursorPosition
}
For whatever reason, after working for about 100+ records (I'm using this as part of a script where I'm regularly performing actions against 1000s of machines), it starts performing double line breaks, which ruins the functionality of the progress bar. So I end up with this...
[ 126 / 2275 ] ComputerName1
[ ] 0% | Verifying network connectivity...
[## ] 10% | Verifying file system access...
[#### ] 20% | Determining installed operating system...
[###### ] 30% | Executing action...
[####################] 100% | Action Completed
[ 127 / 2275 ] ComputerName2
[ ] 0% | Verifying network connectivity...
[## ] 10% | Verifying file system access...
[#### ] 20% | Determining installed operating system...
[###### ] 30% | Executing action...
[####################] 100% | Action Completed
When I should have....
[ 126 / 2275 ] ComputerName1
[####################] 100% | Action Completed
[ 127 / 2275 ] ComputerName2
[####################] 100% | Action Completed
Any thoughts on this issue and a possible workaround?
EDIT #1: Is it possible that this is happening when I hit the buffer height limit of the console (as in, it starts discarding the old lines of output)?
EDIT #2: I have confirmed that this issue goes away if I increase the buffer width and height of my console window. I'm still not sure how to workaround this bug though. Thoughts?
I verified this bug on my own machine. As soon as you start wrapping the buffer, -nonewline fails to live up to its task.
You can do a few things as a workaround:
1) Programmatically increase the BufferSize to a fixed size
$Host.UI.RawUI.BufferSize = New-Object System.Management.Automation.Host.Size(120, 5000)
2) Clear the screen every so often, perhaps every 100 nodes or after each node if you don't need to follow the output
3) Clear the screen only when you've nearly reached the buffer limit
if($Host.UI.RawUI.CursorPosition.Y -gt ($Host.UI.RawUI.BufferSize.Height - 5)) {cls}
4) Clear only old parts of the screen buffer by temporarily reducing the size of the buffer. I used your function, untouched (except renaming to remove the second "-"). With the screen buffer at 100, the odd behavior would start at number 50 (2 output lines per loop)
49 / 2000
[####################] 100% | FINAL
50 / 2000
[#### ] 20% | First
[######## ] 40% | Second
[############ ] 60% | Third
[################ ] 80% | Fourth
[####################] 100% | FINAL
51 / 2000
[#### ] 20% | First
[######## ] 40% | Second
[############ ] 60% | Third
[################ ] 80% | Fourth
[####################] 100% | FINAL
But with the BufferSize switching, I made it all the way to 2000/2000 without a hitch
1998 / 2000
[####################] 100% | FINAL
1999 / 2000
[####################] 100% | FINAL
2000 / 2000
[####################] 100% | FINAL
$range = 1..2000
Test code below:
foreach($i in $range)
{
$Host.UI.RawUI.BufferSize = New-Object System.Management.Automation.Host.Size(120, 3000)
Write-Host
Write-Host $i "/ 2000"
Update-ProgressBar "20" "First"
Update-ProgressBar "40" "Second"
Update-ProgressBar "60" "Third"
Update-ProgressBar "80" "Fourth"
Update-ProgressBar "100" "FINAL"
$Host.UI.RawUI.BufferSize = New-Object System.Management.Automation.Host.Size(120, 2990)
}
Realistically, you could combine 3 and 4 so that you only clear the old parts of the buffer when it is nearly full.

How to create interactive chart with Rebol

I have this code to create a candlestick chart in rebol. Now I'd like to use over feel http://www.rebol.com/how-to/feel.html#section-6 to show info on each candlestick but my box is drawn with draw dialect and it doesn't seem to accept event ?
plot: [
pen green line 5x404 5x440 pen gold fill-pen 0.255.0 box 3x424 7x418 line 10x396 10x422 pen gold fill-pen 0.255.0 box 8x418 12x402 line 15x397 15x436 pen gold fill-pen 255.0.0 box 13x401 17x435 line 20x429 20x447 pen gold fill-pen 255.0.0 box 18x434 22x446 line 25x441 25x464 pen gold fill-pen 255.0.0 box 23x446 27x463 line 30x445 30x493 pen gold fill-pen 255.0.0 box 28x461 32x482 line 35x470 35x504 pen gold fill-pen 255.0.0 box 33x481 37x492 line 40x466 40x498 pen gold fill-pen 0.255.0 box 38x491 42x477
]
grid: [1100 600]
step-grid: 5
max-n-points: (grid/1 / step-grid) - 1
x-axis-border: 20
Y-margin: 10
X0: 5
grid-color: coal
main: layout [
origin 20x0
space 1x1
panel1: box 1100x580 black effect reduce [
'line-pattern 4 4
'grid 30x30 0x0 (grid-color)
'draw plot
]
panel2: box 1100x0 black
panel3: box 1100x20 black
]
view main
Here is a little expansion of my previous answer related to your chart viewer.
there are many ways you may adapt it, but it should give you some ideas into solving your problem.
rebol []
plot: []
data: reduce [ ]
refresh: func [/local clr delta prev-pos pos] [
clear plot
prev-pos: 0x300
foreach [clr delta] data [
pos: prev-pos + (delta * 0x1) + 7x0
append plot compose [
pen (clr) line (prev-pos) (pos) fill-pen (clr) pen none circle dot-size (pos)
]
prev-pos: pos
]
show panel1
]
add-data: func [i][loop i [append data reduce [(random white * .85) + (white * .15) (-20 + random 40)]] refresh]
grid: [800 600]
step-grid: 5
max-n-points: (grid/1 / step-grid) - 1
x-axis-border: 20
Y-margin: 10
X0: 5
grid-color: coal
dot-size: 3
viewer-size: 800x580
; open up console before vid window
main: layout [
origin 20x0
space 1x1
field 800
panel1: box viewer-size black rate 30 effect [
line-pattern 4 4
grid 30x30 0x0 grid-color
draw plot
] feel [
;probe first panel1
over: func [face over? offset /local d][
panel1/pane: either over? [info-pane][none]
if over? [
d: offset/x - face/offset/x - 1
d: (to-integer d / 7) * 2 + 1
either d: pick data d [
info-box/text: to-string d
][
panel1/pane: none
]
]
]
engage: func [face action event] [
switch action [
down [
drag-start: event/offset
]
up [
drag-end: event/offset
scroll-size: to-integer abs ((pick (drag-start - drag-end) 1) / 5)
]
time [
info-box/offset: event/offset - 20x20 ; the offset is the main-window origin
show main
]
]
]
]
panel2: box 800x0 black
panel3: box 800x20 black
]
insert-event-func [
either all [
event/type = 'key
none? system/view/focal-face
][
print ["shortcut: " event/key]
switch event/key [
; escape
#"^[" [quit]
; enter/return
#"^M" [print "resampling data" clear data add-data 100]
up [dot-size: dot-size + 1 show panel1]
down [dot-size: dot-size - 1 show panel1]
left [clear skip tail plot -12 clear skip tail data -2 show panel1]
right [add-data 2]
]
none
][
event
]
]
info-box: make face [
offset: 0x0
color: white * .2
size: 150x30
text: "0.0.0"
font: make font [valign: 'middle style: [bold italic]]
]
info-pane: reduce [info-box]
add-data 100
refresh
view/options main [all-over]
focus panel1
Note that as we move the mouse over the chart, we are only using the X component of the mouse to figure out what to display. Better systems are obvious, but this is sufficient to illustrate what needs to be done to receive all mouse move events and act on them.
Also note that the over feel receives Window offsets, so you must remove the face's offset to get the real face-relative coordinates.
PS: The red arrow above, is my mouse cursor.