필터 지우기
필터 지우기

Problema despues de ejecutar comando "addpath"

조회 수: 10 (최근 30일)
Camilo Cárdenas
Camilo Cárdenas 2024년 8월 23일
댓글: Camilo Cárdenas 2024년 8월 25일
Holas:
Estoy usando Matlb 2021b en una PC-Win10.
Dado que no tengo derechos de administrador, cada vez que iniciaba un programa ejecutaba el comando "addpath" incluyendo el directorio que queria se incluyera:
addpath(genpath('c:\Users\pr8331\C-ccar\00_NuBES\01_Nextcloud\01____K_I_T\54_m\'),'-begin')
Desde hace un tiempo ya empece a percatar que matlab empieza a tener error que no permite que se ejecuten mis codigos (que ya funcionaban previamente).
Por ejemplo estoy tratando de ejecutar mi funcion para buscar la ruta de un archivo:
function [rutArchivo, Dir, Archivo, Extension] = f_PathFile()
% anteriormente llamada f_VenetanaBuscaArchivo => le estoy cambiando el nombre para poder recordarme más facil
%
% Funcion que busca el path de un archivo seleccionado en la ventana.
% Para filtrar por extension en la busqueda primeramente se abre ventana preguntando la extension a buscar
%
% InPUT:
%==========
% No requiere
%
% OutPUT:
%==========
% rutArchivo: string, Ruta del archivo
% Dir: string, path del archivo
% Archivo: string, nombre del archivo
% Ext_ string, extension del archivo
%
% addpath(genpath('\\sccfs-home.scc.kit.edu\home\MATLAB'),'-begin') %esta línea agrega todas las subcarpetas de la Carpeta Matlab para asi leer las funciones sin problema
% addpath(genpath('c:\Users\pr8331\C-ccar\00_NuBES\01_Nextcloud\01____K_I_T\54_m\'),'-begin') %esta línea agrega todas las subcarpetas de la Carpeta Matlab para asi leer las funciones sin problema
%%
defaultValue = {'txt'};
disp(['°fff starting f_PathFile'])
titleBar = 'InPut'; % Click sobre archivo a seleccionar: ';
userPrompt = {'Extencion a usar para la búsqueda: ' };
Entrada = inputdlg(userPrompt,titleBar, [1 35], defaultValue);
Extension = ['*.' char(Entrada(1,1))];
%%
TiituloBarra = ['Busqueda filtrada para archivos del tipo: ' Extension];
disp(['ffff ' TiituloBarra]);
[File,Dir] = uigetfile(Extension, TiituloBarra);
rutArchivo = [Dir File];
disp(['#fff Selected PathFile: ' rutArchivo])
end
Cuando se trata de ejecutar la linea de:
Entrada = inputdlg(userPrompt,titleBar, [1 35], defaultValue);
Obtengo el siguiente error y el programa deja de funcinar, hasa que reinicie matlab nuevamente.
Error: File: system_dependent.m Line: 1 Column: 24
Invalid text character. Check for unsupported symbol, invisible character, or pasting of non-ASCII characters.
Error in usejava (line 44)
isok = system_dependent('useJava',feature);
Error in matlab.ui.internal.utils.checkJVMError (line 14)
if ~isdecaf && ~usejava('jvm')
Error in warnfiguredialog (line 8)
matlab.ui.internal.utils.checkJVMError;
Error in dialog (line 42)
warnfiguredialog('dialog');
Error in inputdlg (line 147)
InputFig=dialog( ...
Error in f_PathFile (line 26)
Entrada = inputdlg(userPrompt,titleBar, [1 35], defaultValue);
Alguna sugerencia?
  댓글 수: 2
Matlab Pro
Matlab Pro 2024년 8월 25일
No sé español lo suficientemente bien, así que uso el traductor de Google.
El error muestra un problema en la línea 26 de f_PathFile.
Una de sus entradas genera el problema. el error dice "...caracteres no ASCII". Parece que "lograste" pegar un carácter que no es ASCII en este código. La mejor manera de depurarlo es poner un punto de interrupción en esta línea y, cuando ejecute la ejecución, marque esta línea y presione F9, creo que obtendrá el mismo error.
luego, puede cambiar manualmente los parámetros "inputdlg", uno por uno para poder encontrar el parámetro problemático
Por ejemplo
línea original, cuando se detiene en el punto de interrupción (breakpoint)
Entrada = inputdlg(userPrompt,titleBar, [1 35], defaultValue);
Ahora, cambio manualmente sus parámetros uno por uno y ejecuto cada "versión".
Entrada = inputdlg('Hola',titleBar, [1 35], defaultValue);
.. y ejecuta esta línea
Entrada = inputdlg(userPrompt,'my title', [1 35], defaultValue);
.. y ejecuta esta línea
Entrada = inputdlg(userPrompt,titleBar, [1 35], '33');
Si, después de uno de los cambios, el código funcionará, sabes que este parámetro fue el problemático.
Buena suerte
Camilo Cárdenas
Camilo Cárdenas 2024년 8월 25일
Hello MatlabPro
thank you very much for the suggestion, I have more or less implemented it this way without being able to find any error in any of the inputs of that line (values used in the function “inputdlg”).
What is surprising, however, is that if I run all those lines without having added my folders, I don't get the error.
Somehow the line:
addpath(genpath('c:\Users\pr8331\C-ccar\00_NuBES\01_Nextcloud\01____K_I_T\54_m\'),'-begin')
is generating the problem.
I have been able to solve the problem by adding my mappings using this line:
addpath 'C:\Users\pr8331\C-ccar\00_NuBES\01_Nextcloud\01____K_I_T\54_m\01_fcns'
Which unlike the one I used initially does not include the subdirectories of the folder.
So I would like to know what is going on.
Writing this and taking into account your answer, it makes me think that maybe in my subdirectories there is a new folder with an character that Matlab does not like. Since this function with these lines has worked fine until about two months ago.
I will check it out.
Thank you very much!

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by