Undefined function 'replace' for input arguments of type 'char'.

Hi, I try to make my program work, but I am struggeling a bit with this mistake. I want to cut off the ending of my file name, e.g. 'NACA_65-209.txt'. Unfortunately the following code is not answering anything. When I try to use e.g. 'strrep' instead my following program ends with errors.
Thank you!
function AirfoilName = get.AirfoilName(ObjectName)
%Replace the file extension by nothing, to receive the
%AirfoilName.
oldString = '.txt';
newString = strcat('');
AirfoilName = replace(ObjectName.FileName, oldString, newString);
end

Antworten (2)

Abi Waqas
Abi Waqas am 7 Mär. 2018

0 Stimmen

Hello Do you mind pasting the code of class? You have shown the method of the class may you are doing something wrong in the class
Steven Lord
Steven Lord am 7 Mär. 2018

0 Stimmen

Which release of MATLAB are you using? I suspect you're using a release prior to release R2016b, which is when the documentation indicates the replace function was introduced.

Kategorien

Mehr zu Get Started with MATLAB finden Sie in Hilfe-Center und File Exchange

Produkte

Tags

Gefragt:

am 17 Jan. 2018

Beantwortet:

am 7 Mär. 2018

Community Treasure Hunt

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

Start Hunting!

Translated by