Software Use > Scripting
Error Adding Secondary Rundecks
(1/1)
bjohnson63:
Hello,
I'd like to add secondary rundecks using MATLAB scripts, but I keep getting an error. The file path strings for the NASTRAN bdf and f06 are correct, but the error still occurs. The code I am using is:
hypdir = 'C:\Users\bjohnson63\Documents\BCA Research\Modeling\uCRM Modeling\Nastran Hypersizer Integration\src\Structures\Hypersizer';
xlevels = [1 1 3 2]; % levels for each input
Xl = 80; % fuel lower bound
Xu = 100; % fuel upper bound
fuelval = linspace(Xl,Xu,xlevels(4))';
oProject.Rundecks.Add([hypdir '\FEM_Results\CRM_SOL144_' num2str(fuelval(i)) '_new.bdf'], ...
[hypdir '\FEM_Results\crm_sol144_' num2str(fuelval(i)) '_new.f06']);
And the MATLAB error is:
Error using Interface.57F66C64_E4E7_4C57_B3E6_C0B00705FF96/Add
Error in Hypersizer7Automation_UQLoads (line 73)
oProject.Rundecks.Add([hypdir '\FEM_Results\CRM_SOL144_' num2str(fuelval(i)) '_new.bdf'], ...
I'd appreciate any assistance!
Ryan:
Hi,
I think there is an issue when you are building the file paths. You might be creating string arrays instead of combining the strings together to form a single string. Try using strcat to combine strings. Use fullfile to build file paths.
fem_directory = strcat(hypdir, '\FEM_Results');
fem_filename = strcat('CRM_SOL144_', num2str(fuelval(i)), '_new.bdf');
f06_filename = strcat('CRM_SOL144_', num2str(fuelval(i)), '_new.f06');
fem_path = fullfile(fem_directory, fem_filename);
f06_path = fullfile(fem_directory, f06_filename);
oProject.Rundecks.Add(fem_path, f06_path);
-Ryan
bjohnson63:
Hi Ryan,
Thanks for the reply! I double-checked and I'm not creating an array, it is a single string. But I did try your code as well and I'm getting the same error message. Unfortunately the MATLAB message doesn't provide much info for the root cause of the error.
~Brandon
Ryan:
Hi Brandon,
What version of HyperSizer are you running? I tried the following code in 7.1.43 with MATLAB 2012, and it appears to work.
One thing you could also try is running similar code in Excel or Python. If those environments give you the same error, it may indicate that something is wrong with the HyperSizer install as opposed to a MATLAB syntax issue.
hypdir = 'C:\HyperSizer Data\Projects\Collier\_Training UM\RLV\FEA';
fem_file1 = [hypdir '\rlv_' num2str(1) '.dat'];
f06_file1 = [hypdir '\rlv_' num2str(1) '.f06'];
fem_file2 = [hypdir '\rlv_' num2str(2) '.dat'];
f06_file2 = [hypdir '\rlv_' num2str(2) '.f06'];
runDecks = project.Rundecks;
runDecks.Clear();
runDecks.Add(fem_file1, f06_file1);
runDecks.Add(fem_file2, f06_file2);
runDecks.Save()
-Ryan
Navigation
[0] Message Index
Go to full version