Hello!
I encountered a problem and hope that you can help me.
After exporting data from a resulting graph to a txt file I need to make further calculations
using Octave, a MatLab clone.
Thus I need to convert data in the txt-file into a custom format to another txt-file.
But this does not work as usual and the resulting file only contains strange characters.
After opening the exported file from Multphysics I noticed that the coding in the text-exitor automatically
had changed to "UCS-2 Little Endian".
After setting the encoding to ANSI and saving the file, everything works line a charm.
Is there a way to set the standard encoding of Multiphysics' output format?
Or do you have other ideas?
Kind regards,
Walter
Could you share more details here, such as version (2011 or 2012), Windows in English or other language?
It works fine in my machine, 2012, Win 7 x64 in US English.
Hi!
Version is 2012, English.
You say it works on your machine - what exactly have you tried to do?
Since I am in Europe, my decimal separator usually is a comma. The exported data looks like
0,000 28,500
607,143 25,357
1214,286 22,903
1821,429 20,976
2428,571 19,448
I need to change the decimal separator to a dot first to be able to calculate using Octave.
Thus I read the exported file line by line as a string and simply replace the commas with dots.
It seems that only the first line is read wrong, because if I display the lines as they are modified
all except the first look fine. The first line shows that typical ascii-rectangle followed by the
numbers it should show:
s_old = ■0 , 0 0 0 2 8 , 5 0 0
All other rows look fine.
Is there a way to export the file from multiphysics directly to a file that uses a dot as decimal reparator?
This option is missing in the export dialog...
Thanks for explanation. I got it now.
I don't think 2012 has the feature to set number format here.
I believe this is one of Windows features (changing number format).
Also, why don't you change it with text-editor like notepad by opening the text file and replacing all "," with "."?
Thanks.
The problem is that I need to calculate a lot of stuff and cannot convert each file by hand.
Thus I wrote an Octave-script to read the file line by line, replace , by .
Then the calculation should begin by first importing the file into Octave.
But the file produced by MultiPhysics can not be converted correctly due to some strange reason.
I have to open it using a text editor, which says its format is "UCS-2 Little Endian", then I need to click
"Save as ... ANSI-Format" and after that I can work with the file correctly.
So I would like to change MultiPhysics export format somewhere, because the real problem is not due to
the decimal limiters but to the fact that I can not read the first line correctly.
Any ideas?
One thing maybe you can try is "type" command.
For examples, your old file is myoldfile.txt in NON-ANSI format.
Open a windows cmd prompt, run the command "type myoldfile.txt > mynewfile.txt".
Supposedly, the mynewfile.txt should be in ANSI format.
SaMurgie,
Do you mean the Windows regional settings or has Multiphysics 2012 its own regional settings?
S.LI,
your hint to use "type" is a good workaround. I found a batch script to convert all files in a folder at once.
So until there is a better solution, I will use the script. Maybe it helps other, too, so here it is:
---
@Echo Off
echo UniCode to ANSI converter for TXT.
md ~ANSI
for %%a in (*.txt *.?txt?) do type "%%a">"~ANSI\%%a"
for %%a in (*.txt *.?txt?) do attrib -r -h -s "%%a"
cd ~ANSI
for %%a in (*.txt *.?txt?) do move /y "%%a" ..
cd..
rd ~ANSI
---
Yes, the Windows Regional Settings. Adsk Sim MP uses the Windows Regional Settings.
BTW, we are looking into this issue...
Changing the windows regional settings does not solve the problem.
I do not have to convert the decimal separators, but since I have to read the file anyway to import its contents into a matrix the problem occurs anyway.
You mentioned that you are working on "this issue", what exactly are you working on?
As far as I found out by now, the issue is not generally due to MultiPhysics, since the export file format is quite common.
I had a look into the files using a hex-editor.
The exported (non-working) file is encoded in UCS-2 little endian.
If I convert the file to ANSI, everything works fine and I can read process the
file using Ocatve.
The content in clear text should be
---------
0,000 28,500
---------
This in the non-working UCS-2 file exported from MP in hex reads:
----------
FF FE 30 00 2C 00 30 00 30 00 30 00 09 00 32 00 38 00 2C 00 35 00 30 00 30
----------
In clear text in the hex editor it reads
----------
ÿþ0.,.0.0.0...2.8.,.5.0.0
----------
The working, to ANSI converted file that does not cause problems
in Octave reads in hex:
---
30 2C 30 30 30 09 32 38 2C 35 30 30
---
the clear text shown in the hex editor is
---
0,000.28,500
---
So somehow the FF FE, the first characters in the UCS-2 file seems
to cause the problem. This first two bytes are called BOM (Byte Order Mark).
Due to them programs can usually find how the file is encoded.
As far as I found out by now Octave does not support this feature,
so it complains on files starting with BOM.
Some useful modifications at MultiPhysics export dialog could be:
- allow to extract each node into a single file in format NODE_NUMBER.TXT
- allow to extract selected nodes directly by right-click > export...without having to graph them first
- use only one single window (combine file selection and format options)
- allow to set export file encoding (this would solve my issue)
By the way, is there a way to "script" MultiPhysics2012? I need to export nodal values
from identical models with different border constraints...so I would like to automate that
is its possible...
Kind regards,
Walter
The reason for Autodesk simulation to output Unicode text (not ANSI format), I guess, is for wide character, since labels in other languages should be supported correctly.
Yes, Shanhu, that is the case. We want to support double-byte character sets.
But no, scripting is not readily possible with Multiphysics, unfortunately.