The “parfeval” command is not working on the addPath function
I have a cell array that contains the folder paths that I want to add to the project path. Initially, I used the clasic for loop; however, as the cell array contains more than 2K folder paths, this clasic for loop takes more than 2 hours to complete the task. To overcome this issue, I have used the "parfeval" command in the for loop, but I am getting the error mentioned below.
Error Details:
Caused by:
Error using matlab.project.Project/addPath
Dot indexing is not supported for variables of this type.
How can i resolve this issue?
Below is my code:
%get current project
proj_modelBasedDesignCodeGen = currentProject;
% List of folder paths
FolderPaths = {‘componentsComponentA’, ‘componentsComponentB’, ‘componentsComponentC’, ‘componentsComponentD’};
% Preallocate cell array to store output
futures = cell(1, numel(FolderPaths));
% Loop through each folder path and submit a task to the parallel pool
for i = 1:numel(FolderPaths)
inputFolder = FolderPaths{i};
% Use parfeval to asynchronously evaluate function addPath
futures{i}= parfeval(@addPath, 1,proj_modelBasedDesignCodeGen, inputFolder); % 1 is the number of output arguments
endI have a cell array that contains the folder paths that I want to add to the project path. Initially, I used the clasic for loop; however, as the cell array contains more than 2K folder paths, this clasic for loop takes more than 2 hours to complete the task. To overcome this issue, I have used the "parfeval" command in the for loop, but I am getting the error mentioned below.
Error Details:
Caused by:
Error using matlab.project.Project/addPath
Dot indexing is not supported for variables of this type.
How can i resolve this issue?
Below is my code:
%get current project
proj_modelBasedDesignCodeGen = currentProject;
% List of folder paths
FolderPaths = {‘componentsComponentA’, ‘componentsComponentB’, ‘componentsComponentC’, ‘componentsComponentD’};
% Preallocate cell array to store output
futures = cell(1, numel(FolderPaths));
% Loop through each folder path and submit a task to the parallel pool
for i = 1:numel(FolderPaths)
inputFolder = FolderPaths{i};
% Use parfeval to asynchronously evaluate function addPath
futures{i}= parfeval(@addPath, 1,proj_modelBasedDesignCodeGen, inputFolder); % 1 is the number of output arguments
end I have a cell array that contains the folder paths that I want to add to the project path. Initially, I used the clasic for loop; however, as the cell array contains more than 2K folder paths, this clasic for loop takes more than 2 hours to complete the task. To overcome this issue, I have used the "parfeval" command in the for loop, but I am getting the error mentioned below.
Error Details:
Caused by:
Error using matlab.project.Project/addPath
Dot indexing is not supported for variables of this type.
How can i resolve this issue?
Below is my code:
%get current project
proj_modelBasedDesignCodeGen = currentProject;
% List of folder paths
FolderPaths = {‘componentsComponentA’, ‘componentsComponentB’, ‘componentsComponentC’, ‘componentsComponentD’};
% Preallocate cell array to store output
futures = cell(1, numel(FolderPaths));
% Loop through each folder path and submit a task to the parallel pool
for i = 1:numel(FolderPaths)
inputFolder = FolderPaths{i};
% Use parfeval to asynchronously evaluate function addPath
futures{i}= parfeval(@addPath, 1,proj_modelBasedDesignCodeGen, inputFolder); % 1 is the number of output arguments
end parallel computing MATLAB Answers — New Questions