Data import with specific column data as seprate matrices

Data import with specific column data as seprate matrices - Data import with specific column data as seprate matrices - Messages

#1 Posted: 2/22/2024 8:11:35 PM
aster

aster

0 likes in 2 posts.

Group: User

Hi,

I am new into the smath solver. I was using PTC mathcad prime v4.0. I have a force table in text/excel file from which I need to define each column as separate matrices. Please refer below snap from mathcad and help me how to do the same in smath solver
Fig.1.JPG
#2 Posted: 2/22/2024 11:38:54 PM
overlord

overlord

552 likes in 1332 posts.

Group: Moderator

Every csv/xls/txt input-output command to SMath can be different.
It can need slight alterations according to format/version, etc.
If you can provide your Clamp Forces.txt file it would be easier.

Regards
#3 Posted: 2/23/2024 12:56:20 PM
aster

aster

0 likes in 2 posts.

Group: User

Please find attached text file.

Clamp Forces_ACC.txt (988 B) downloaded 31 time(s).
#4 Posted: 2/23/2024 4:16:22 PM
overlord

overlord

552 likes in 1332 posts.

Group: Moderator

There are two problems with your data file.

P1 - Your file is a comma separated file (CSV), without commas.
P2 - Strings are not between double quotes.

It can be imported into SMath but with compromises.
I wrote two methods for this two problems.
One is importing only essential data, other is whole table.

S1 - A typical CSV file uses commas, yours used tabular key instead.
importdata() can read it as it is, but writing tab as string is the key.
It is not possible to write tab character in Smath directly.
Yet it is not completely impossible, you can enter it via copy/paste.
What I did is open a notepad, wrote \0009\, which is ascii code for tab.
Then paste it between double quotes. Here the solution for first problem.
Now your numbers can be imported via partial importing.

Click to expand

S2 - I mentioned strings are not between quotes in your file.
Thus, just solving tab separation problem won't import your whole table.
As I have said earlier, strings should be quoted in a CSV file.
Because of that, your strings are not considered as strings by SMath.
SMath can read it without quotes but it will consider them as variables.
So it won't look right when import is concluded, if it can. Which I doubt.
You need to put strings between quotes. There is two way for this.
You either put it quotes manually via a text editor.
Or import in excel, select string cells, format them as text cells.
Then save your CSV file after necessary alterations made.
Without not forgetting to change your delimiter/separator to comma.
As it is the common way. After that you can import your file flawlessly.

Click to expand

When importing part is done, rest is splitting data into columns.
You can find how I did in the file below. Just extract them to same directory.

Regards

import_clamp.zip (4 KiB) downloaded 31 time(s).
  • New Posts New Posts
  • No New Posts No New Posts