필터 지우기
필터 지우기

Dot indexing is not supported for variables of this type

조회 수: 7 (최근 30일)
Khalala Mamouri
Khalala Mamouri 2020년 8월 31일
댓글: Khalala Mamouri 2020년 8월 31일
Hi,
I am developping an app, where i want to load data from a .m fille to fill items for a drop down list. How ever in run into an error "Dot indexing is not supported for variables of this type". Any one knows how to fix this issue ? my code is bellow . Thank you
function startupFcn(app, varargin)
evalin('base', 'clear all')
evalin('base', 'clc')
list = fopen('VehicleList.m','r'); % Read data from the file
A = textscan(list, '%c'); % Importing data
fclose(list); % close file
AB = char(A); % Cell to char conversion
assignin('base','A', A); % send to workspace
assignin('base','AB', AB); % send to workspace
app.VehicleModelDropDown.Items = AB.VehicleList; % << I get the error here
function UpdateVehicleList(app,new_car)
VehicleList = [app.VehicleModelDropDown.Items new_car];
save('VehicleList.m','VehicleList','-append');
app.VehicleModelDropDown.Items = VehicleList;
end
end
  댓글 수: 13
Mohammad Sami
Mohammad Sami 2020년 8월 31일
편집: Mohammad Sami 2020년 8월 31일
Another option can be to use readcell and writecell functions.
function startupFcn(app, varargin)
VehicleList = readcell('vehiclelist.txt');
app.VehicleModelDropDown.Items = VehicleList;
end
function UpdateVehicleList(app,new_car)
VehicleList = [cellstr(app.VehicleModelDropDown.Items) cellstr(new_car)]';
writecell(VehicleList,'vehiclelist.txt');
app.VehicleModelDropDown.Items = VehicleList;
end
Khalala Mamouri
Khalala Mamouri 2020년 8월 31일
it works just fine . Wow you are amazing man !

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by