HOW TO READ A .WRL FILE IN MATLAB?
19 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Dear Sir,
I have written the following code to read a 3D .wrl file in MATLAB.
for i= 1:61
filename1=strcat(path1,strcat(a,int2str(i)));
filename=strcat(filename1,'_');
filename1=strcat(filename1,b(i));
filename1=strcat(filename1,'.wrl');
vrfile=fopen(filename1);
end
path1 is defined earlier as path1='D:\'
but when I am running the code I am geeting the following error:-
Error using fopen
First input must be a file name of type char, or a file
identifier of type double.
Error in Readobj_Gavabdb (line 27)
vrfile=fopen(filename1);
But instead of filename1 if i write 'D:\gavaDB\cara1_abajo.wrl' the program is running.
Please somebody tell me how to make the above code run. Kindly mail me at :- paramabagchi@gmail.com
0 comentarios
Respuestas (1)
Cris LaPierre
el 19 de Nov. de 2020
The most obvious error I see is that you change the varialbe name when you append the '_'. You save that result to filename. You then use filename1 in the next line, which means the underscore is not appearing in your final result.
You might want to consider using the function fullfile to create filename1. You can do it in a single line of code, and it will handle adding the slashes, etc. for you.
for i=1
filename1 = fullfile("D:","gavaDB",["cara" + num2str(i) + "_" + "abajo" + ".wrl"])
end
0 comentarios
Ver también
Categorías
Más información sobre String Parsing en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!