I'm a PhD student at MIT. Ask me anything!

xolp3000

Supremacy Member
Joined
Jun 4, 2002
Messages
6,106
Reaction score
0
Eh, gotta quick qns. Was just doing some simple Matlab stuff.

Was trying to do a simple program to calculate Celsius to Fahrenheit.

This is what I got below

clc;
C=input('Enter Temperature in Celsius ','s');
while ~isempty(C)
C=str2num(C);
disp(['Cesius to Fahrenheit = ',num2str(C.*9/5+32)]);
C=input('Enter Temperature in Celsius ','s');
end

Just wondering, is there any way of not using str2num and num2str when doing this ?

:s11::s11::s11:

Celsius to Fahrenheit equation: (C*9/5+32)
use input without the 's' argument to get numeric input.

I also prefer fprintf to num2str, cause you dont have to worry that much about concatenation. But both are functionally identical. I prefer to use break to exit an infinite while loop in this case, cause I can condense the two input statements into a single line while preserving the same functionality.
Code:
clear;clc
while true
    C=input('Input ');
    if isempty(C), break, end
    fprintf('Output %.1f\n',C.*9/5+32);
end
 

xolp3000

Supremacy Member
Joined
Jun 4, 2002
Messages
6,106
Reaction score
0
Engineering courses should have introductory Matlab as a module. Matlab is quite easy to pick the basics. Think Matrix (not the movie) ....

ok lah, matlab is pretty good to pick up basics. there are also good built in libraries for equation solving, linear algebra, statistics, systems of nonstiff and stiff odes, optimization and other numerical algorithms built in, which makes it a quick and dirty tool.

but for some operations it can be godawful slow. win some lose some...
 

xolp3000

Supremacy Member
Joined
Jun 4, 2002
Messages
6,106
Reaction score
0
Quick, buy a Lange! :p

if you know me enough, you know that im very against jewellery or branded goods. for me to buy something, it must have a measurable utility.

haha, when i have excess cash ill spend on stuff thats practical lah, not on jewellery or branded goods. last time in singapore, i would spend on recording studio equipment or on my car.

now, haha, grad student liao, no time, whatever little money i have i spend on vacations lor...
 

yuyuthecat

High Supremacy Member
Joined
Jul 7, 2011
Messages
27,927
Reaction score
79
if you know me enough, you know that im very against jewellery or branded goods. for me to buy something, it must have a measurable utility.

haha, when i have excess cash ill spend on stuff thats practical lah, not on jewellery or branded goods. last time in singapore, i would spend on recording studio equipment or on my car.

now, haha, grad student liao, no time, whatever little money i have i spend on vacations lor...

why u so smart? :(

lolol how are you yuyu?

still surviving the bitter cold in newfoundland?

super windy but it hasnt snowed yet.

did it start snowing at your area yet?
 

livinginanavatar

Master Member
Joined
Feb 10, 2011
Messages
4,049
Reaction score
0
Not sure if this is related, but has the cure for cancer been found?

It seems to me if it has been found, some authorities are restricting a public release bcos they can make more money not releasing it.
 

$ingaporean

Senior Member
Joined
Feb 14, 2013
Messages
542
Reaction score
120
Today I'm staying home to get some work done, rather than going outside.

The stormy weather today, very windy and snowy...

NwicbLN.png


uoqM2uF.jpg

Is this view from your apartment?

Nice view u have.
 

xolp3000

Supremacy Member
Joined
Jun 4, 2002
Messages
6,106
Reaction score
0
Not sure if this is related, but has the cure for cancer been found?

It seems to me if it has been found, some authorities are restricting a public release bcos they can make more money not releasing it.

Cancer is not a single disease. So its very unlikely that a general cure for cancer will be found.

Nope, if people found a real cure for cancer, they'd patent it and make a heck of a lot of money selling the cure to people. But as I said, its very very unlikely that a single cure for cancer will be found.
 

Mach3.2

Great Supremacy Member
Joined
Apr 8, 2011
Messages
72,496
Reaction score
2,472
if you know me enough, you know that im very against jewellery or branded goods. for me to buy something, it must have a measurable utility.

haha, when i have excess cash ill spend on stuff thats practical lah, not on jewellery or branded goods. last time in singapore, i would spend on recording studio equipment or on my car.

now, haha, grad student liao, no time, whatever little money i have i spend on vacations lor...
Which means more pictures liao, this time round go where? :p
 

xolp3000

Supremacy Member
Joined
Jun 4, 2002
Messages
6,106
Reaction score
0
Which means more pictures liao, this time round go where? :p

Dunno. Next year I will be posted as a consultant from the department to two companies, for two months each. Basically you go there to solve a problem that the company has.

Flights will be paid for by the department, and the department typically pays for reasonable flights to your destination. So people typically take 1-2 weeks off before to go somewhere nice before starting their consultancy gig. I'm planning to take 1 week off before, 1 week off between the two companies, and 1 week off after.

But have to wait till the department does the assignment lah. Based on where I get posted to, I'll plan lah. I hear that on the table are Maryland, Illinois for US based firms, and England and Ireland for international postings. And most people will get one local one international posting lah...

I should have news next week!
 

xolp3000

Supremacy Member
Joined
Jun 4, 2002
Messages
6,106
Reaction score
0
Beautiful. U r a blessed man.

Thanks, its a nice view lah, but i just dont like sharing an apartment with others. Prior to this I used to stay alone in a studio apartment. Next year I will be posted out of Boston, but when I return I'll be looking for a studio.

I think I'm just too used to living alone liao. Got too used to living alone in Singapore and in my first year here!
 

xolp3000

Supremacy Member
Joined
Jun 4, 2002
Messages
6,106
Reaction score
0
BFTaHeS.jpg


last photo on a cloudy night.

theres only one way I can take a photo out my window though, cause the window doesnt open fully, probably to prevent suicide in the hi-rise. But yeah, theres no way for me to set up a tripod, and I have to rest the camera on the ledge.
 
Important Forum Advisory Note
This forum is moderated by volunteer moderators who will react only to members' feedback on posts. Moderators are not employees or representatives of HWZ Forums. Forum members and moderators are responsible for their own posts. Please refer to our Community Guidelines and Standards and Terms and Conditions for more information.
Top