1 Pages (4 items)
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
#2 Posted: 2/22/2024 11:38:54 PM
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
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
#4 Posted: 2/23/2024 4:16:22 PM
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.

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.

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).
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.
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.
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).
1 Pages (4 items)
-
New Posts
-
No New Posts