diff --git a/Sources/ThirdParty/Wrappers/Petsc/Vector/VectorInitMethods.cpp b/Sources/ThirdParty/Wrappers/Petsc/Vector/VectorInitMethods.cpp
index f94b6a8ca259ad88f9bf000d4388c711440776c5..a28e162a086c351f22fc7ad655978515aadf8e8c 100644
--- a/Sources/ThirdParty/Wrappers/Petsc/Vector/VectorInitMethods.cpp
+++ b/Sources/ThirdParty/Wrappers/Petsc/Vector/VectorInitMethods.cpp
@@ -198,8 +198,14 @@ namespace MoReFEM
                 
                 while (getline(stream, line))
                 {
+                    // 4 lines to ignore in PETSc Matlab format.
+                    if (Utilities::String::StartsWith(line, "%")
+                        || Utilities::String::StartsWith(line, "Vec_")
+                        || Utilities::String::StartsWith(line, "];"))
+                        continue;
+
                     // All lines are expected to be one value.
-                   value_list.push_back(stod(line));
+                    value_list.push_back(std::stod(line));
                 }
                 
                 // Now Init the vector with the appropriate size.