Code and decode an entire struct to and from a plain string
이전 댓글 표시
Hi,
I need to convert an arbitrary struct to a plain string. I’m going to pass the sting as one single argument to a standalone executable (the exe also built and compiled with MATLAB). Within the exe I’m going to decode the string and rebuild an identical copy of the original stuct. Hence, the string needs to contain all metadata about the struct.
Also: The struct to be passed to the exe is not going to be static. Each time it may contain different fields, cell arrays, etc. But the struct is only going to contain numerical values and strings.
Has anyone done this before and could share the code or give some advice?
Also wondering if there is any limitation on amount and/or size of arguments that could be sent as argument to an exe on the Windows platform?
Should mention that I’m rather new to MATLAB.
// Lars
댓글 수: 5
Yeech... :)
Use save and load instead...
ADDENDUM:
Unless later versions have modified it (and I'd be really surprised given that command processor is being phased out as much as can be by MS) the line limit is 1023 on MS shells. The enhanced command shell from JPSoft will internally accept multi-line command lines that can expand alisases and/or environment variables up to a total limit of 2X that but for that to happen it has to be two actual commands submitted on the one line w/ the line separator character embedded...
Lars
2013년 10월 5일
Image Analyst
2013년 10월 5일
편집: Image Analyst
2013년 10월 5일
Why is the much, much simpler option of using a mat file to transfer your variable not an option? Why is the much more complicated and difficult way of doing it the way you (a self-described MATLAB beginner) thought up the only option worth considering?
Lars
2013년 10월 5일
dpb
2013년 10월 5일
The performance of binary mat-file transfer will far outpace ascii string transfer of a serialized structure (orders of magnitude difference).
채택된 답변
추가 답변 (1개)
Image Analyst
2013년 10월 5일
0 개 추천
You can pass variables directly in via the argument list if you make the program a server instead of a standalone executable, but I don't know the details, so call the Mathworks and they can tell you.
카테고리
도움말 센터 및 File Exchange에서 Data Type Conversion에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!