Multiplication function not working correctly

Hi all, I am trying to convert data from hPa to Pa by multiplying 100, but I don't seem to get the correct answer. Also, I am not sure why do I get asterisk after calculating the first entry, which seems to me affecting the rest of the entries! Here is my code. Many thanks Update: - I have already used (.) but I came up with the same result.
TestData2 = importfile('TestData1.xlsx','Sheet1','A1:F31');
hPa=TestData2(1:31,6) %Pressure at 9m in hPa
Pa=hPa*100

7 commentaires

Use, Pa=hPa.*100
D.J
D.J le 26 Août 2018
I used that already, it didn't work. I got same results as before.
Aquatris
Aquatris le 26 Août 2018
Wwhat do you get? We cannot help too much unless you provide your data.
Stephen23
Stephen23 le 26 Août 2018
Modifié(e) : Stephen23 le 26 Août 2018
@D.J: please do not post the same question multiple times. It actually makes it harder for us to help you, because then you spread information over multiple threads, so it is harder for us to know what information you have given us, and what information you have been given in return. Today I moved your uploaded files to this question.
Please update this question with any data, or add comments as required.
Aquatris
Aquatris le 26 Août 2018
By the way your code works for me. It multiplies all the elements by 100. What exactly is your issue?
One issue might be your hPa is not double but chars (variable type, you can check it in Workspace, where it should indicate something like "hPa 31x6 double". I used import data functionality of Matlab, where you can find it in Home tab in Matlab.
D.J
D.J le 26 Août 2018
@Stephen Cobeldick. I didn't post the question multiple times. When i clicked "submit" the first time, there was a technical error from Matlab website itself. So, I had to repeat the process. Not really my fault !
Stephen23
Stephen23 le 26 Août 2018
Modifié(e) : Stephen23 le 26 Août 2018
@D.J: please explain what "...but I don't seem to get the correct answer." actually means: how are you testing the output? What do you expect to get?

Réponses (0)

Cette question est clôturée.

Question posée :

D.J
le 26 Août 2018

Clôturé :

D.J
le 26 Août 2018

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by