cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X

How do I convert matrix or column from string to number?

yrereq
1-Newbie

How do I convert matrix or column from string to number?

OK, I successfully imported .csv file into Mathcad Prime using READCSV.

My .csv file contains a table, one column are dates and another are numbers, there also a spurious empty columns.

I have no idea how to deal with dates, but my primary interest is second column with numbers.

But problem is, Prime interprets the whole csv table as matrix of string values, despite of numbers on second column are well-formed.

I tried str2num function, but it refuses to do the job, probably due non-scalar input. How do I pre-process this column to finally start my real calculations?

As a bound, could anyone please advise on dates in the following format: "2010-06-26",...

Thank you.

1 ACCEPTED SOLUTION

Accepted Solutions
RichardJ
19-Tanzanite
(To:yrereq)

I tried str2num function, but it refuses to do the job, probably due non-scalar input.

Use the vectorize operator

 

As a bound, could anyone please advise on dates in the following format: "2010-06-26",...

You will have to use Mathcad's string functions to convert that to three numbers, but then to use that date see here: Date Calendar and Time functions.mcd - PTC Community

View solution in original post

2 REPLIES 2
RichardJ
19-Tanzanite
(To:yrereq)

I tried str2num function, but it refuses to do the job, probably due non-scalar input.

Use the vectorize operator

 

As a bound, could anyone please advise on dates in the following format: "2010-06-26",...

You will have to use Mathcad's string functions to convert that to three numbers, but then to use that date see here: Date Calendar and Time functions.mcd - PTC Community

yrereq
1-Newbie
(To:yrereq)

As a bound

This one is an autocorrection artifact, ofc I mean to say "As a bonus".

Thanks,

Top Tags