Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to load .raw data with spice list directive #5

Open
ethangoldstein opened this issue Mar 10, 2021 · 3 comments
Open

Unable to load .raw data with spice list directive #5

ethangoldstein opened this issue Mar 10, 2021 · 3 comments

Comments

@ethangoldstein
Copy link

ethangoldstein commented Mar 10, 2021

Hello,

I am able to load the .raw file when I run a basic .tran command. However, when I include a .step directive in the simulation I get the following error from MATLAB:

Error using reshape
Size arguments must be real integers.

Error in LTspice2Matlab (line 531)
raw_data.variable_mat = reshape(raw_data.variable_mat, mat_size(1), mat_size(2) / num_steps, num_steps);

Error in test (line 6)
sr = LTspice2Matlab(path);

Any help would be greatley appreciated.

Thank You,

Ethan

@yc-niu
Copy link

yc-niu commented Dec 8, 2021

I got the same error. Attached is an example file that comes with LTspiceXVII that can reproduce this error.

C:\Program Files\LTspiceXVII\examples\Educational\FRA\Eg1.asc
Run simulation -> Eg1.raw

".tran 0 {5/Freq+.1m} .1m" in Eg1.asc can save computation burden significently, but it cause the simulation data points (and also the matrix size) vary depends the variable {Freq} along each step.

(line 531) "mat_size(2) / num_steps" is not compatible with this situation and causes the error.

I would appreciate taking consider this situation. Thank you.

YC Niu
Eg1.zip

@kunkun9527
Copy link

@ethangoldstein @yc-niu

I also had this problem recently, but finally solved it perfectly.

I guess the reason is because the length of the data is inconsistent, since LTSpice is a solver with variable step size.

The solution is to use the software "ltsputil.exe" to interpolate the data in the raw file to achieve a consistent step size. For the new version of LTSpice, you also need to use "ltsputil17raw4.exe" to convert raw files.

The above software can be easily found in google. Below is the code I use, just for reference:

cd/d D:\Circuit_results\sweep_new\verify
ltsputil17raw4.exe fixed_frequency.raw converted_fixed_frequency.raw
ltsputil.exe -eo converted_fixed_frequency.raw output_fixed_frequency.raw 40000

Note that they should run by CMD command, or use the batch file.

@kunkun9527
Copy link

One more important step is to keep raw uncompressed, the following command can be used in LTSpice.

.opt plotwinsize=0

But this will greatly increase the raw file size.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants