Info

Cette question est clôturée. Rouvrir pour modifier ou répondre.

Index Exceed Marix Dimensions

1 vue (au cours des 30 derniers jours)
Timothy
Timothy le 12 Juil 2013
Clôturé : MATLAB Answer Bot le 20 Août 2021
Hello, I am trying to repopulate an input dialog box with answers the user previously put in. I am saving the file correctly but when I try and load the answers I am getting the error index exceed matrix dimensions. I think that it is a +1 or -1 error, can someone look at the code and help with debugging and give an explanation for this problem, thank you.
PrefFile = fullfile(prefdir, 'MyGUI.pref');
if exist(PrefFile, 'file')
FileData = load(PrefFile, '-MAT');
cell_FileData = struct2cell(FileData);
for i=1:NumQuest;
set(EditHandle(i),'String', cell_FileData{1,i});
NumQuest - 1;
end
end
  1 commentaire
Matt J
Matt J le 12 Juil 2013
Timothy Commented:
So my problem is in cell_FileData it is a 1 x X cell I don't think that it is stepping forward with the rest of the program is there a way to fix it?

Réponses (2)

Matt J
Matt J le 12 Juil 2013
Modifié(e) : Matt J le 12 Juil 2013
Either cell_FileData is shorter than NumQuest or EditHandle is.
  1 commentaire
Matt J
Matt J le 12 Juil 2013
Modifié(e) : Matt J le 12 Juil 2013
cell_FileData it is a 1 x X cell I don't think that it is stepping forward with the rest of the program
If X<NumQuest there is nowhere for it to step forward. Are you sure your loop is supposed to run from 1 to NumQuest, or is it in fact supposed to go from 1 to X?

Timothy
Timothy le 12 Juil 2013
Modifié(e) : Matt J le 12 Juil 2013
Relocated to Comment by Matt J

Cette question est clôturée.

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by