• New Horizons on Maelstrom
    Maelstrom New Horizons


    Visit our website www.piratehorizons.com to quickly find download links for the newest versions of our New Horizons mods Beyond New Horizons and Maelstrom New Horizons!

Matlab Stuff

Pieter Boelen

Navigation Officer
Administrator
Storm Modder
Hearts of Oak Donator
<!--quoteo(post=320840:date=May 19 2009, 11:12 AM:name=Hawkeye)--><div class='quotetop'>QUOTE (Hawkeye @ May 19 2009, 11:12 AM) <a href="index.php?act=findpost&pid=320840"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->I don't have that much time for playing any more, other than Matlab, that is<!--QuoteEnd--></div><!--QuoteEEnd-->

<!--quoteo(post=320849:date=May 19 2009, 11:06 AM:name=Pieter Boelen)--><div class='quotetop'>QUOTE (Pieter Boelen @ May 19 2009, 11:06 AM) <a href="index.php?act=findpost&pid=320849"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->Matlab? What are you doing with Matlab? By a strange matter of coincidence, I ended up doing a lto of work with that too the past few months.
Good thing I had programming experience from modding PotC; that was certainly a big help. <img src="style_emoticons/<#EMO_DIR#>/icon_mrgreen1.gif" style="vertical-align:middle" emoid=":cheeky" border="0" alt="icon_mrgreen1.gif" /><!--QuoteEnd--></div><!--QuoteEEnd-->

<!--quoteo(post=320868:date=May 19 2009, 12:45 PM:name=Hawkeye)--><div class='quotetop'>QUOTE (Hawkeye @ May 19 2009, 12:45 PM) <a href="index.php?act=findpost&pid=320868"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->Doing research with a lot of optimization and monte-carlo-simulations involved, using an optimization toolbox developed by our institute basically.
I learned to program earlier than pimping code for my PotC, though it was the first C-ish code i've read. I've done Fortran before that...
Pity, one could not reach all functions that way, AI sailing is a mess in AoP2 again, not to mention the animation of the sails...

Good game nonetheless.<!--QuoteEnd--></div><!--QuoteEEnd-->

Two months ago I wouldn't even have known what Monte Carlo Simulations were,
but now I already performed a couple of thousands on my research on weather routing for ships. <img src="style_emoticons/<#EMO_DIR#>/icon_mrgreen1.gif" style="vertical-align:middle" emoid=":cheeky" border="0" alt="icon_mrgreen1.gif" />
That was not with Matlab, though Matlab did get involved for analysing the results. <img src="style_emoticons/<#EMO_DIR#>/rolleyes.gif" style="vertical-align:middle" emoid=":rolleyes:" border="0" alt="rolleyes.gif" />
I used Matlab for making a lot of animations of ships sailing accross the Atlantic Ocean.
 
<!--quoteo(post=320879:date=May 19 2009, 12:17 PM:name=Pieter Boelen)--><div class='quotetop'>QUOTE (Pieter Boelen @ May 19 2009, 12:17 PM) <a href="index.php?act=findpost&pid=320879"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->Two months ago I wouldn't even have known what Monte Carlo Simulations were,
but now I already performed a couple of thousands on my research on weather routing for ships. <img src="style_emoticons/<#EMO_DIR#>/icon_mrgreen1.gif" style="vertical-align:middle" emoid=":cheeky" border="0" alt="icon_mrgreen1.gif" />
That was not with Matlab, though Matlab did get involved for analysing the results. <img src="style_emoticons/<#EMO_DIR#>/rolleyes.gif" style="vertical-align:middle" emoid=":rolleyes:" border="0" alt="rolleyes.gif" />
I used Matlab for making a lot of animations of ships sailing accross the Atlantic Ocean.<!--QuoteEnd--></div><!--QuoteEEnd-->

Wow, you seem to be resistant to frustration, doing animations in Matlab and Modding in PotC... <img src="style_emoticons/<#EMO_DIR#>/wink.gif" style="vertical-align:middle" emoid=";)" border="0" alt="wink.gif" />
That's an advantage for programming, I think...
 
Resistant to frustrations? Not really; things can get VERY annoying. But I usually laugh about them, because some of the things I ran into are just <i>toooo</i> crazy!
Examples:
- I found a Matlab import code that imports correctly when you use the File>Import Data button but NOT when you use the generated M-code.
- At some point I asked Matlab the result of 56/1 and actually got five answers! Turned out that "56" was a string. <img src="style_emoticons/<#EMO_DIR#>/mybad.gif" style="vertical-align:middle" emoid=":facepalm" border="0" alt="mybad.gif" />
 
<!--quoteo(post=320885:date=May 19 2009, 01:17 PM:name=Pieter Boelen)--><div class='quotetop'>QUOTE (Pieter Boelen @ May 19 2009, 01:17 PM) <a href="index.php?act=findpost&pid=320885"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->...
- At some point I asked Matlab the result of 56/1 and actually got five answers! Turned out that "56" was a string. <img src="style_emoticons/<#EMO_DIR#>/mybad.gif" style="vertical-align:middle" emoid=":facepalm" border="0" alt="mybad.gif" /><!--QuoteEnd--></div><!--QuoteEEnd-->

Hihi, that's a good one... <img src="style_emoticons/<#EMO_DIR#>/laugh.gif" style="vertical-align:middle" emoid="xD:" border="0" alt="laugh.gif" />
But one should be aware of var names in all languages, thats not a Matlab speciality. Others would have crashed at this point (or given a compiler error).

Matlab doing different things in code and via GUI is typical, sadly... Especially when different versions come into play...

But we should stop this, there's Matlab Central for that kind of chatter, not PA... <img src="style_emoticons/<#EMO_DIR#>/wink.gif" style="vertical-align:middle" emoid=";)" border="0" alt="wink.gif" />
 
True, though we can also just start a seperate thread. <img src="style_emoticons/<#EMO_DIR#>/razz.gif" style="vertical-align:middle" emoid=":razz" border="0" alt="razz.gif" />

That import problem was REALLY annoying though; it imported the first line correctly and after that it started making up numbers that resemble the correct ones but are not the correct ones.
So I was forced to write my own import function. And I friggin' never even <i>learned</i> programming. <img src="style_emoticons/<#EMO_DIR#>/mybad.gif" style="vertical-align:middle" emoid=":facepalm" border="0" alt="mybad.gif" />
 
<!--quoteo(post=320892:date=May 19 2009, 01:51 PM:name=Pieter Boelen)--><div class='quotetop'>QUOTE (Pieter Boelen @ May 19 2009, 01:51 PM) <a href="index.php?act=findpost&pid=320892"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->True, though we can also just start a seperate thread. <img src="style_emoticons/<#EMO_DIR#>/razz.gif" style="vertical-align:middle" emoid=":razz" border="0" alt="razz.gif" />

That import problem was REALLY annoying though; it imported the first line correctly and after that it started making up numbers that resemble the correct ones but are not the correct ones.
So I was forced to write my own import function. And I friggin' never even <i>learned</i> programming. <img src="style_emoticons/<#EMO_DIR#>/mybad.gif" style="vertical-align:middle" emoid=":facepalm" border="0" alt="mybad.gif" /><!--QuoteEnd--></div><!--QuoteEEnd-->


What I'm using for importing data is "textscan" and "fscanf", but that's quite low level.
But you're right, I think there is not one single thing more often occuring than having to write your own import function because Matlab won't read your data file... and it sucks...

That one with "first line right, rest wrong" sounds like an import wizard thing. What function did you try to use? There's some option to define "header lines", if I remember correctly. Can't find it though...
 
I used the textscan function now too, which I did get to work eventually. Originally I used the "File > Import Data" function.
If I import through that menu, it works fine, but if I do it through the generated M-code, it does something different. Oh well, it's working now. <img src="style_emoticons/<#EMO_DIR#>/dunno.gif" style="vertical-align:middle" emoid=":shrug" border="0" alt="dunno.gif" />
 
...the heck is Matlab? <img src="style_emoticons/<#EMO_DIR#>/blink.gif" style="vertical-align:middle" emoid=":blink:" border="0" alt="blink.gif" /> <img src="style_emoticons/<#EMO_DIR#>/laugh.gif" style="vertical-align:middle" emoid="xD:" border="0" alt="laugh.gif" /> And Monte Carlo Simulations? Wtf? <img src="style_emoticons/<#EMO_DIR#>/laugh.gif" style="vertical-align:middle" emoid="xD:" border="0" alt="laugh.gif" />
 
<a href="http://en.wikipedia.org/wiki/MATLAB" target="_blank">http://en.wikipedia.org/wiki/MATLAB</a>

<a href="http://en.wikipedia.org/wiki/Monte_Carlo_simulations" target="_blank">http://en.wikipedia.org/wiki/Monte_Carlo_simulations</a>

What is it? Advanced research stuff!
 
Oh. <img src="style_emoticons/<#EMO_DIR#>/yes.gif" style="vertical-align:middle" emoid=":yes" border="0" alt="yes.gif" />
 
Back
Top