« first day (1148 days earlier)      last day (2304 days later) » 

06:48
Hi guys!
Can someone try to run the example code in the help of the rgb2ind function?

RGB = imread('ngc6543a.jpg');
[X,map] = rgb2ind(RGB,128);
figure, image(X), colormap(map)
axis off
axis image

When I do it I get the following error:
"Undefined function 'cq' for input arguments of type 'uint8'."
and I cannot figure out why...
Apologies, the complete error message is:
Undefined function 'cq' for input arguments of type 'uint8'.

Error in rgb2ind (line 91)
[map,X] = cq(RGB,m);
And line 91 is (in my rgb2ind at least..):
[map,X] = cq(RGB,m);
Sam
Sam
07:38
It looks to be the second argument of rgb2ind() I believe
do you have an idea why it is a problem?
Sam
Sam
Just having a play now
Hmmm according to the source my Octave function does not take other parameters for that function. Which version of MATLAB do you have?
2018a
it says that "RGB2IND(RGB) is a deprecated syntax." So I need the second input
Sam
Sam
Yup that was a mistake on my part... Octave takes a single input RGB whereas MATLABs function takes the either n or tol
I'm guessing in your case you are setting n= right
07:54
@shamalaia The code from the documentation runs for me just fine on R2015a. If you want I can check again in 30 mins on 2016B
No, thank you very much.
I checked with a colleague of mine who has the same version and it runs fine with her
So it is probably something weird and wrong with my environment
What does which cq give you?
/MATLAB_library/rotating_3d_globe/bin_geoid_3d/graphics_functions_for_R2008a/rgb‌​2ind.m
ok I think I got it
thanks
that path is wrong
it works. THANKS!
08:29
17
Q: Why is a trailing comma in a cell array valid Matlab syntax?

chessofnerdI was surprised today to discover that A = {1,2,3} and B = {1,2,3,} are both valid syntax in MATLAB. I would have expected the second statement to yield an error. As best as I can tell, they produce identical cell arrays (all([A{:}]==[B{:}]) returns true). Is there a reason the second syn...

@AnderBiguri @gnovice @CrisLuengo you were the ones talking about weird MATLAB syntax right? Made me think of the above question ^
I first could not find it, but now that @thewaywewalk is here, I could via his profile. Brilliant answer that is.
Hey there o/
Sam
Sam
Hello
08:42
54
Q: Come Take a Look at our New Contributor Indicator!

Tim Post This feature is now live across the network. We've been doing quite a bit of research into ways that we could help new users have better experiences that ultimately lead them to becoming increasingly valuable, long-term contributors to our sites. While this is still ongoing, it's starting to...

blargh. This feels like I'm in a padded day care centre cell where I need to put on gloves and a face mask before I can touch anything and where I definitely need my tinfoil hat before I can go outside.
User is new, so what, they still should've taken the tour and read the pages like [ask] and [mcve] ffs
Andras was ranting about it up there ^
My "Shiny new 'downvote me' indicator!" comment has been deleted. Did a new user™ take offense at it? Because I was merely trying to say what others have too: that it will place a bullseye on new users. Just like Student driver signs where I'm from, mind you. But it's good to know that meta is also burdened by the most ridiculous things getting flagged (and deleted). — Andras Deak yesterday
:D
just saw that. Good job @AndrasDeak! Te vagy a leggjob
@CrisLuengo that's what happens in the big tags. I frequently see stuff in Android along the lines of "<image>, how get dis effekt in me app?" get 5 answers and +7 within a few minutes, because other noobs know the answer and thus answer+upvote the Q to get more votes on their answers, and other noobs want that same effect.
@Adriaan I'm actually here to advertise this bounty: stackoverflow.com/q/4227145/2605073
So if there are bored bounty hunters out there, I could need some better references.
Thats from 2010, but what I assume it happens is that the JIT compiler applies? so, num is not converted to double and then to vpa, but instead MATLAB is smart enough to realize you want the original number
no?
maybe not, sorry I havent even read the existing answers :P
@thewaywewalk mhm, is that something we can answer though, or do you need a TMW employee to tell you that?
Reading all the stuff about that new contributor indicator and older things about that blogpost makes me want to just quit spending time on SO main, and just hang out here to chat with you louts
Sam
Sam
08:56
If anybody has a minute.. I'm still struggling with differntiating that function from yesterday... I've written my steps out in LaTex to make it easier to follow my thought sharelatex.com/2867426699spbtysbznvtx
wait @thewaywewalk, what are you exactly having prblems with that the existing answer does not asnwer?
@Sam (2x)^someting == 2^something else * x^something ?
no
Sam
Sam
I thought root(2x) == root(2) * root(x)
Sam
Sam
So can I not split them the way I have
so (2x)^-4/3 is then what?
apply your logic
(2x)^-4/3 = ?
09:00
@Sam under "using the power rule" you suddenly change from constant*division to constant-division. I.e. you change multiplication to an addition (or subtraction here), which is not the proper way. The 2^(1/4) can also be visualised and denoted as being above the division line (i.e. in place of the 1)
(2x)^-4/3 =? 2^(-1/3)*x^(-4/3)
where did the 1/3 come from?
Sam
Sam
@AnderBiguri Seperating the 2. The numerator being its power and denominator being the root
root(2x) == root(2) * root(x)no?
Sam
Sam
Yeah
And then I transform it into an exponent by ^
so (2x)^1/2 = 2^1/2 * x^1/2 ?
So why

(2x)^-4/3 = 2^(-1/3)*x^(-4/3) ??? and why not (2x)^-4/3 = 2^(-4/3)*x^(-4/3)
ah no wait
you are right
Sam
Sam
09:04
Because I'm treating sqrt(2x^2) as sqrt(2) * sqrt(x^2) == 2^1/2 * x^2/2 ?
I thouhg it was (2x)^4
my bad,
need more coffe
Sam
Sam
lol
@Adriaan I've just emitted the multiplication symbol here. the negative is for the negative fraction
listen to Adriaan then
@Sam YOU WHAT?
2-4 is 2*(-4) ?????
Sam
Sam
?
Wait what
@Sam what does this mean
Sam
Sam
09:08
Under the power rule 2^(1/3) * (-(4/3) * 1/ x^) isn't it
So yeah you did a-bx but you really mean a*(-bx)
I am going to stop talking to you for 5 months, while I recover from the coma you just induced me into :P
Sam
Sam
I'm trying :(
no worries man
@Sam for the love of God, please do not omit multiplication signs when you put pluses or minuses in between. That'll mess up your (and everyone else's) understanding of what you're doing
just write the maths properly
Sam
Sam
09:09
Let me edit, sorry guys :p
you literally wrote 3-5 when you mean 3*(-5)
you can see why that is wrong no?
Sam
Sam
Yeah I do
great then :D
so what is really your question?
because up there is good
Sam
Sam
OK I just rewrote the power equation.. does it automatically propagate to your screen?
no need to use \times, you can omit the symbol, but not the parenthesis
fix the next step too
Sam
Sam
09:13
Look better?
so, from the step with y1,y2, to the one that you have y', you just decided to omit the 2^something
which would make your answer the desired answer
Sam
Sam
And I thought the reason for that is because the derivative of a constant is just 0?
change your notation to get a clearer image
after "Using the power rule: " you already have the derivatives
they are y1' and y2'
@AnderBiguri I wouldn't call it a problem, but I could need a more convincing answer, as it really matters for my current research. If it can't be explained better, with references, Andrew deserves the bounty anyway ;) So lets see what happens.
Sam
Sam
@AnderBiguri ?
09:16
@thewaywewalk why more convincing? Genuinelly asking. That is actaully what happens. vpa uses the double, just shows the decimal places of the error too
@Sam give me write access
wait, I can comment
Sam
Sam
I just put your email in :D
wrote some comments
The things you find in answers... see the edit history
Sam
Sam
@AnderBiguri "emit" XD
I just farted out the constants
yeah
notation matters :D
try to be strict at it
it helps you not get confused
IF you'd saw that they where already derivatives, maybe that would have helped you realize they shoudl be there
Sam
Sam
09:23
@AnderBiguri This may sound stupid how do you know once you have the full derivative?
how do you know what?
Sam
Sam
y' = y_1 + y_2 isn't it
> IF you'd saw that they where already derivatives
no, because you defined y_2 as a positive thing
Well, answerer disagrees with me. I already removed the downvote (it is a good answer, just shouldn't be there), but the text does need to be removed.
If you would have seen that they were already derivatives ...
my broken english
@Sam basically I meant to say that you probably would not have been confused if teh text read y_1', because you woudl have noticed its alreayd a derivative. Its a derivative because you made it be
being 100% anal about your math notation is the key to doing proper maths
Sam
Sam
09:29
Thanks. Am I right to have what I've got so far?
there is atypo in "clean up" you are missing a minus
Sam
Sam
Does that look ok?
I think so
is that the answer?
leeft you a couple of nice LaTeX examples&tips
Sam
Sam
@AnderBiguri That is the answer but I'm just going back through to make sure I haven't made a mistake. I understand it now though
@AnderBiguri @Adriaan thanks both!
Sam
Sam
09:43
That's the hardest derivative I've taken to date :P
ah, sweet child of summer
2
sin(x)^sin(x)
Sam
Sam
no more!
Andras is good with derivatives
he helped me get one for my thesis :D
5
Q: Gradient of the TV norm of an image

Ander BiguriContext: I am trying to implement an algorithm for X-ray image reconstruction called ADS-POCS that minimizes the TV norm as well as reconstructs the image. After separating the reconstruction into 2 steps, namely data reconstruction and TV norm minimization, the second part is solved by a steepe...

Sam
Sam
I'm yet to find something he doesn't know
09:46
Ancient Greek Ortography
Sam
Sam
@AnderBiguri tf
@AnderBiguri did he get the full page thank you note your supervisors suggested? :P
Sam
Sam
@AnderBiguri HA! Rookie
haha no. I wanted to write his name on pink comic sans, to stand out
In the end I wrote him a tahnks (and a ref) by adding 2 typos to his name
my way
@AnderBiguri PDE Ander Deak? :P
09:48
I don't remember. But he spotted it and I fixed it :D
@AnderBiguri lol :D
I guess I'll have to thank Andras as well somewhere on my diploma, because I'd have failed my math courses without him.
Sam
Sam
@AnderBiguri Yup the answer checks out and I understand it. My notation was screwing with me. I didn't realise I could have rewritten the constant 2^ as a root :D
lol, I'm the math grandpa
Sam
Sam
mathpa
09:59
\o/ my Iterative Reweighted Least Squares (IRLS) scheme runs on the first try without errors!
Problem is: only zeros come out :p
@AnderBiguri vpa(0.000008,24) 0.00000799999999999999963798489 - this does not make sense. So what does Matlab internally? Especially, because vpa(sym('0.000008'),24) = 0.000008. What is different in this case?
0.000008==0.00000799999999999999963798489
I suspect
in double, yes.
but obviously not in vpa
it is a double though
vpa takes the double and makes and object with the exact same value
But that is not what we see? 0.000008 can be expressed as a double number without problems, the vpa form is different though.
It feels like vpa(0.000008,24) tries to find a fraction of 24-digit integers
I do calculations with the symbolic math toolbox with digits(34) which should equal 128-bit floating point. If I multiply my 34-digit result with e.g. vpa(0.000008,34) it does matter, wheter it is 0.000008 or 0.00000799999something (maybe it does not matter in the long run, but it's an error which I'd like to avoid, if possible)
10:08
The problem is that only binary fractions can be exactly represented (i.e. in finite binary digits). Once you have a double or a double literal you've already lost precision. Wherever precision matters you have to use vpa('num')
@thewaywewalk can it?
I don't think so
I use this webpage to test sometimes: exploringbinary.com/floating-point-converter
@Andres as far as I understand, 0.000008 can be exactly represented as binary
No it can not
I doubt that myself
check the linked webpage, its quite handy
10:11
the obvious resolution is to construct the corresponding binary fraction
why the hell can't you compare vpa() numbers to doubles?
Maybe I totally misunderstand something, but I don't know what. A floating point number has a mantissa, in this case "8" which in binary is 1000 and I have an exponent which is 6, so 0110
yea, its not m*10^e, its m*2^e
Thats why Andras was mentioning binary fractions
not decimal fractions
alright I got this. But then again, what happens in case vpa(sym('0.000008'),24)?
10:16
there is no double in that anywhere
vpa(sym(0.000008),24) ~= vpa(sym('0.000008'),24)
and how are the calculations done? are there no binary operations involved at all?
sym and strings are redundant there
@thewaywewalk they are done with sufficient precision, formally with infinite precision
@thewaywewalk which calculations?
would vpa(sym('0.000008'),24)*vpa(sym('0.5'),24) would work entirely different than double(0.000008)*double(0.5)?
the vpa ones? They are symbolic calculations, not numerical ones. The ALU of your CPU is not used. It is as if they were mathematical concepts. That is also why its way slower.
10:18
the problem is when you say 0.00008 to MATLAB, it already gets converted to the nearest representable double which is 0.000007999999999999999637984894607090 or something
@thewaywewalk very!
but you can drop the sym and keep the strings
It is a symbolic engine that runs VPA
blargh how the hell can I compare vpas numerically? Piece of shit
>> 0.1 + 0.2 == 0.3

ans =

  logical

   0

>> vpa('0.1') + vpa('0.2') == vpa('0.3')

ans =

0.3 == 0.3
if this weren't a piece of crap you'd get true for the latter
a=vpa(sym('0.000008'),24);
b=vpa(sym('0.5'),24);

tic; a*b;toc
Elapsed time is 0.001228 seconds.
tic;double(0.000008)*double(0.5);toc
Elapsed time is 0.000195 seconds.
also double(...) is also redundant
yeah, but even more in my favour
goes through functions, still is faster.
10:21
Python to the rescue
>>> 0.1 + 0.2 == 0.3
False
>>> Decimal('0.1') + Decimal('0.2') == Decimal('0.3')
True
So I would need to understand, how the symbolic engine works. Or could it be possible that, the symbolic engine just uses base 10 to do calculations?
@thewaywewalk you needn't care how it works! It's exact, as if you wrote it on paper :)
@thewaywewalk it does not use "numbers" for calculations
but I get a result, so at some point it has to, hasn't it?
Do by hand 3452*234. You go taking the digits one by one, making multiplications of single integers and adding the results together
something like that
10:23
@thewaywewalk the result is also a symbolic result, it's vpa(...) rather than a double
once you convert to double you introduce an error that you'll never recover from
But ultimatelly, as Andras says, you can know that the result will have infinite precission
this is why you never put double literals inside a vpa() or sym() call
then you will introduce error by making it double
"You go taking the digits one by one, making multiplications of single integers and adding the results together something like that" -> yeah, so base 10. It would match the fact, that I define the precision of vpa by digits and not by bits
because by the parser is done it's already a (usually different) double value
10:25
@thewaywewalk it was an analogy eh, not sure how it does it
@AnderBiguri I know, its speculative again anyway.
its an advanced symbolic engine. Some magic there :D
lot and black
My collegeagues don't believe in magic, thats the problem
the implementation is supposed to guarantee that it's exact as long as you work with sym/vpa
how it does it is irrelevant, and whether you trust it is a different matter
10:27
@AndrasDeak I did, until yesterday, when my collegeague put everything in question ;)
The same way you don't (even want to) know how elementwise addition is vectorized for 4d arrays. You just know that you're guaranteed to end up with a result that is "correct".
you should trust it though :D IT has definitely infinite precision if used correctly
if you did vpa(num_literal) then you were merely using it wrong :)
So thanks guys, that was what the bounty was for. Feel free to write an answer :p
hehe
if I write an answer it will address the XY problem, not so sure that's worth a bounty
10:29
But it should be quotable :p
the whole question is worth a bounty, and understanding whats happening is worth a bounty, because not a lot of people do
*original question
@Ander wanna give it a proper shot?
maybe we shoudl edit the answer and let the answerer get that bounty
I am in fact triying to answer another one that I got idioticly stuck with
> I suspect vpa() behaves this way because it treats its inputs as exact values, and polymorphically supports other Matlab types from the Symbolic Toolbox that have more precision than doubles. Those values will need to be initialized by means other than numeric literals, which is why sym() takes a string as an input and vpa(exp(1)) differs from vpa(sym('exp(1)')).
that's in the existing answer which probably mentions what I primarily have in mind as an aside
I'm OK with clarifying that point to address the XY
10:32
go for it
I can do that sometime later. But that shouldn't be a problem, the bounty can still attract answers (hopefully good ones) :D
gotta go for a while now
0
A: Secondary axes get displaced when resizing figure in Matlab

Ander BiguriYour problem is that one axis has a colorbar and other does not, and even if you would add a colorbar to both axis, there can be quite a lot of automatic things going on that would resize your axis differently. However, we can add an event listener and define a function to operate make both axi...

ah finally
 
2 hours later…
Sam
Sam
12:19
@AnderBiguri Do you have a link for that scipub website for free papers?
scihub
but its taken down by goverments, the bastards
use the telegram bot, using telegram web app
Sam
Sam
What what what is that
then just chat with the scihub bot
send him DOIs or links to papers
Sam
Sam
12:34
ooo. Tidy
thanks
13:28
another comment removed from MSE
I wonder whom I offended now. Of course I know it's probably the same thing as last time: sarcasm is against the CoC now
that is not offensive in any possible way
it's sarcastic, and the last time a sarcastic comment of mine was deleted I got this when I protested:
@AndrasDeak Avoid sarcasm and be careful with jokes — tone is hard to decipher online. Your comment looked to me like you were suggesting that folks downvote when they see that indicator, perhaps out of protest or something else. But, I didn't notice it until a few other people saw the same thing and flagged it. — Tim Post ♦ yesterday
that link points to the CoC and is a quote from it
@flawr I installed ansys. It comes with liek 20 separate programs
I have the impression im going so far trhough arabbit whole just to get a file format XD
13:57
@AndrasDeak the answer you got there from Sonic is sarcastic too? “They went with empirical evidence instead of [running an experiment]”. :D
@AnderBiguri Ok, that deserves a +1.
thanks :D
I thought of that solution but decided it was waaaay too much work to write it down. :)
ah, those 5 lines of code have been exhausting indeed :P
nah,I lie, it took me a while
its also a suprisingly good first question
because he's basque, we do everything good always, of course
@Adriaan I don’t understand that answer. I’ll have to read it again a few times. It makes no sense to say that you can put multiple semicolons in a row because that indicates empty statements, but not multiple commas, especially after stating that both can be used to separate statements.
@AnderBiguri haha!
14:18
@flawr you use that software? I managed to make a .inp file (which seems to be abaqus) by meshing it with gmsh for testing. However while Paraview is supposed to read it, it reads empty stuff. Would you be able to open this type of file? Can I sent it to you to see if its Paraview or Gmsh that is complaining?
@CrisLuengo they can, but the thing is MATLAB expects another statement after a comma, whereas after a semi-colon it expects on of three things, and one of those is a null-statement. Thus it accepts that content as a null-statement and continues, whilst it expects a not-null statement after a comma
@Adriaan disp(0),,,disp(1) is just as valid as disp(0);;;disp(1)
At least in R2017a
@CrisLuengo also {1,2,,,,3}?
@CrisLuengo just confused
@Adriaan No, just as a statement separator both , and ; work identically. As matrix element separators they don't.
I've found the reason, I think. I'm writing a new answer to that question. :)
15:05
OK. Here's my arguments:
0
A: Why is a trailing comma in a cell array valid Matlab syntax?

Cris LuengoMany languages allow one extra element separator in lists, as already mentioned. But this has nothing to do with run-time parsing. Even C allows it. It has to do with ease of use. This is a feature meant to help the user. For example, in C you can define an enum as follows: enum E { a, b, ...

15:22
in SO Close Vote Reviewers, 1 hour ago, by TylerH
@TylerH If anyone is curious, here are my styles to hide the new contributor notice from the comment box and answer box: #post-editor .new-contributor-indicator { display: none; } form[id^="add-comment-"] .new-contributor-indicator { display: none; }
In case anyone else is interested (cc @AndrasDeak)
Tyler's description of how to add it to your browser is a bit lower in that chat
 
1 hour later…
16:38
@AnderBiguri how's Heriot-Watt University? I got an email from my supervisor that they have an interesting position
Cool position and they pay 20k/yr, they have an extra Research Training and Support Grant, which is 5k/yr, added to the default stipend
It's basically machine learning for the seismic processing chain
@Adriaan At the Dubai campus? :p
Looks like a serious university. As I said earlier, look for a good advisor, not just a good university.
Serious, but 375th or thereabouts on the worlds list
@CrisLuengo urf, if you scroll down, the menu bar comes along, unattached to the top
Ghe, Heriot-Watt is one of the two unis in the world offering a Brewing and Distillation program :D
17:02
@Adriaan I don't see that. But it's an ugly website nonetheless. It used to be more functional, hadn't looked at it in 3 years... :)
Damn, sometimes I sit there writing an answer, then realize the question is a year old...
17:29
Rare sighting of a good question stackoverflow.com/questions/51972190/…
18:05
@AnderBiguri sorry, I've only used it once a while back:/
I can try to dig up some stuff but probably only at the weekend
@AndrasDeak thanks for this
19:06
I get bothered by some of the most random stuff possible:
2
Q: Ordering for next tag badge options

Cris LuengoI wonder how the "next badge" options for tag badges are sorted. In the screen shot below, the matlab tag is recommended, and shown first, even though I'm closer to getting the algorithm badge: I need write another 3 x 9 answers for algorithm, expecting the same number of votes, to get that ba...

Somehow, the new "NOOB!" badges don't bother me at all. :)
(well, they do, but not as much as it does others)
lucky you
My comment on that great question I linked above got deleted. Seriously, people are flagging the most ridiculous shit
flagging and deleting...
Yes, it takes 2 idiots, one to flag and one to delete.
For what it's worth I'm aware of the difficult situation mods are nowadays
I don't see how that comment of yours could be offensive. Maybe it's offensive to the developers at SE, who don't like to be criticized. :)
the one I mean was congratulating the OP for a great question, and that it's a sight for sore eyes
19:13
Sure, people are paying more attention to the work of the mods now, and expecting more from them.
19:43
Is this creepy, or am I overreacting? stackoverflow.com/posts/51972987/revisions
very, nice catch
agreed, dismissive and patronizing
Good to hear it's not just me then. :)
@CrisLuengo There's a comment from you there on the intellij site out of context. Has something been deleted?
or just appreciating the plugin?
20:05
@AndrasDeak Yeah, just appreciating the plugin. I had been looking for this last year, it seems really complicated to make such a plugin so never ventured into that myself.
just hope that it doesn't get flagged and removed :|
I use CLion to write C++ code, it's nice being able to edit corresponding M-files in the same editor.
@AndrasDeak "Awesome! Thanks!" What's wrong with that?
too chatty? I don't know :D
55 mins ago, by Andras Deak
the one I mean was congratulating the OP for a great question, and that it's a sight for sore eyes
20:22
Well, as long as they don't think I'm stalking her. :)
 
1 hour later…
21:27
@Adriaan Not a bad place, not exceptionally famous but not a bad place at all. Ultimatelly if you like the project that would have more impact than where you've done it
I heard that they had a bit of a low, but now they are injecting shitloads of money into the uni and its recovering ultra fast. But this is just academic gossip AFAIK
not bad
And its in Edinbourgh, which is amazing :D
there is a small hypotetical chance I go around there too

« first day (1148 days earlier)      last day (2304 days later) »