How to execute and run a external program in matlab?

Hi everyone,
I'm trying to exexute an external program in matlab, I used
!ISLab2000IWS 1-INP.in2 (where ISLab2000IWS is the software, and 1-INP.in2 is the input file I want to run)
But it only opens the software window and load the input for me, it's not running the analysis. The window is shown below. The 'Run Analyze' button is under the 'Tools', I was wondering, how can I make it run automaticlly? Really appreciate it.
Capture.JPG

11 个评论

What happens if you enter
ISLab2000IWS 1-INP.in2
at the Windows command prompt?
I just tried, it didn't work.
ISLab2000IWS 1-INP.in2
Undefined function or variable 'ISLab2000IWS'.
Where is the program, ISLab2000IWS , installed?
yes, it's in the same folder as my input file
Make that folder the current folder and try
ISLab2000IWS 1-INP.in2
again.
Yes, it is the current folder. But didn't work :(
Undefined function or variable is a message you would get from MATLAB. per asked you to run
ISLab2000IWS 1-INP.in2
at the MS Windows command prompt, not the MATLAB command prompt.
I am having difficulty finding documentation on ISLAB2000, Lev Khazanovich et al . It clearly exists, but I cannot seem to locate a distribution or documentation point for it.
I just run the ISLab2000IWS 1-INP.in2 in Windows conmmand prompt, it pump up with the same as what I mentioned in my question. It opened the software and file, but it didn't actually run it. Thanks
As we do not have documentation on that program, all we can suggest is that you could use Java Robot class.
"with the same [...] but it didn't actually run it"
  • There is no reason to expect a different behavior when invoked from Matlab than from the MsWindows prompt.
  • Look for "Command Line Commands" or similar in the documentation of ISLab2000IWS

请先登录,再进行评论。

 采纳的回答

Agreeing with what others have said, if the external software doesn't provide a programmatic way to run it's likely to be difficult or impossible to automate its execution.
You could use the Java Robot class as Walter suggested to try to automatically click on the buttons, but figuring out the right place on screen to click could be challenging.
You could ask the authors of that external software if there is a programmatic interface as per isakson suggested.
Or depending on what you're trying to do, you may be able to use a different product to perform your analysis. A quick Google search found that this is likely a finite element analysis program for pavement analysis. While it doesn't look like we have an example specifically for pavement analysis in the list of Partial Differential Equation Toolbox examples you might want to skim the list to see if there are any that look like they might be adaptable to the type of analysis you want to perform.

更多回答(1 个)

% MATLAB program to simulate and detect gravitational waves from binary neutron stars

clc; clear; close all;

% Constants g = 6.67430e-11; % Gravitational constant (m^3/kg/s^2) c = 3e8; % Speed of light (m/s) m1 = 1.4 * 1.989e30; % Mass of first neutron star (kg) m2 = 1.4 * 1.989e30; % Mass of second neutron star (kg) d = 1e22; % Distance from Earth (m)

% Time vector t = linspace(0, 1, 1000); % Time in seconds

% Chirp mass M = ((m1*m2)^(3/5)) / ((m1 + m2)^(1/5));

% Gravitational wave frequency (simplified approximation) freq = (1/pi) * ((g * M)^(5/8)) / (c^(3/8) * (t + 1e-3).^(3/8));

% Generate gravitational wave signal h = (4 * g * M) / (d * c^2) .* cos(2 * pi * freq .* t);

% Add noise to simulate real detector data noise = 0.1 * randn(size(t)); detected_signal = h + noise;

% Plot the waveform figure; plot(t, detected_signal, 'b'); hold on; plot(t, h, 'r', 'LineWidth', 1.5); hold off; legend('Noisy Signal', 'Pure Gravitational Wave'); xlabel('Time (s)'); ylabel('Strain'); title('Simulated Gravitational Wave Detection'); grid on;

类别

帮助中心File Exchange 中查找有关 Startup and Shutdown 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by