Die Frage bezog sich auf das Scipt, zu welchem du mir damals verholfen hast.
Jenes, welche viele Files aus nem bestimmten Ordner raussucht und in ne Matrix speichert.
Da gibts jetzt ein problem: Das Programm lädt nur Daten, die an zweiter Stelle eine zweistellige Zahl haben, amsonsten gibt es den Error:
error: regexp: range out of order in character class at position 17 of expressi
n
error: called from:
error: M:\fwt\members\mw5697\fc.m at line 18, column 2
hier noch das Script:
Code:
function[M] = fc(a,b,c,d,e,f,pfad) % Function to load any amount of files of target direction % with the name like: phs0a-b_000c-d_0000e-f
% Using the variables of the function to define the file name % fix and mod are used to round the variables c and d, so if u use % Numbers from 1 to 9, they're written as 01 -09
% defining list as the direction u've chosen by typing the variables in Octave-command-window
list=dir([pfad,'\*']);
% defining names as a combination of list and names
names={list.name};
% regexp is used to check names with the string above and save all the matched ones in X
X=regexp(names,string,'match');
% returns the indicies of the empty cells.
ind=cellfun('isempty',X);
% ~means "not", or in our case "without" % so X now stands for all the files, which could be identified through our function(insert)
X=X(~ind); % delete the empty cells % in this case the number of the files identified.
len=length(X);
% for-loop to read all the files defined through the function-insert % in reads all the files which matched through regexp and identified by cellfun tic for ii=1:len
% due to an unknown reason, it returns the files with an additional 0-vector as first, this is needet to delete it Cell{ii}(:,1)=[];
% all the matrices are saved in workspace one by one,(in a cell), this is needet to bring em all in one matrix(double)
M = cell2mat(Cell');
end;
und wenn ich halt für c oder d was einstelliges schreibe, kommt dieser regexp-error:
Zitat:
error: regexp: range out of order in character class at position 17 of expressi
n
error: called from:
error: M:\fwt\members\mw5697\fc.m at line 18, column 2
Hiho =)
Hab abermals viele Dank für deine schnelle antwort! )
Es ist ein Fehler von mir gewesen irgendwie =)
Also das hat nichts damit zu tun, dass die Zahlen in Einstellig oder zweistellig sind.. sondern damit, dass die ersten Files lehr sind. Wenn dies der Fall ist, bricht der sofort ab. Is aber warscheinlich nicht so schlimm =))
Ganz nebenbei würde ich dich gerne noch was fragen... diese Funktion braucht für 5 MB Daten ca. 40 Sekunden zum Laden.. und für 18 MB ca 1200 Sekunden.. auf nem ziemlich mächtigem Rechner =) weißt du zufällig, womit das zusammenhängt? Ist schon ziemlich lang =)
Bzw. wo das programm so viel Zeit benötigt? davor und danach werden andere Programme laufen gelassen, zum beispiel zur Berechnung von Daten. das geht dann wieder sehr schnell. naja =)
da ich nicht mit Matlab sondern mit Octave arbeite, gibt es dort sowas leider nicht =)
Ich benutze hierfür den tic toc Befehl.
Ca. 1/3 der Zeit geht für die For-Schleife weg und 2/3 für den dlmread-Befehl. Der Rest ist irrelevant kurz. Seltsam finde ich nur, dass die Zeit nicht linear sondern Proportional ansteigt, und zwar extrem =)
Habs noch nicht mit anderen befehlen probiert, bin aber grad dabei diese Sache irgendwie zu beschleunigen, da es in der Uni mit 100x-Mb großen Datenmängen gemacht werden muss, und da sollte es nach Möglichkeit nich so lange dauern ))
P.S.
Gibt es denn auch eine Möglichkeit, dass er die Fehlermeldung bei Regexp nicht macht, wenn ich leere Files auswähle? Also das er sie auch "mitlädt"?
SOll ich da den "isempty"-Teil weglassen?
Gruß
Paet0r
Einstellungen und Berechtigungen
Du kannst Beiträge in dieses Forum schreiben. Du kannst auf Beiträge in diesem Forum antworten. Du kannst deine Beiträge in diesem Forum nicht bearbeiten. Du kannst deine Beiträge in diesem Forum nicht löschen. Du kannst an Umfragen in diesem Forum nicht mitmachen. Du kannst Dateien in diesem Forum posten Du kannst Dateien in diesem Forum herunterladen
MATLAB, Simulink, Stateflow, Handle Graphics, Real-Time Workshop, SimBiology, SimHydraulics, SimEvents, and xPC TargetBox are registered trademarks and The MathWorks, the L-shaped membrane logo, and Embedded MATLAB are trademarks of The MathWorks, Inc.