欢迎来到天天文库
浏览记录
ID:44271321
大小:681.50 KB
页数:22页
时间:2019-10-20
《matlab讲义10》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、SavingWorkspaceDirectoryManagementFormattedOutputLow-LevelI/OImportingExcelWeek10FunctionDescriptionsavesavefilenamesavefilenamevar1var2...Saveworkspacetomatlab.mat.Savetofilename.mat.Saveonlyvariablesvar1var2....loadloadfilenameloadfilenamevar1var2...Loadworkspacefrommat
2、lab.mat.Loadfromfilename.mat.Loadonlyvariablesvar1var2....SavingWorkspaceWorkspace–spaceofallvariablesSaveworkspace–noneedtorecreatethemnexttimeLoadworkspace–re-loadwhatyouhavesavedandonlywanttostoreBforlateruse.Use:>>a=rand(20,1);>>B=toeplitz(a);Supposeyouhavegenerated:>>s
3、avelastsessionBWhenwewanttousethematrixBagaininthefuture,wecanjustreloadthem:>>loadlastsessionWorkspaceWindowYoucanalsosavetheworkspacebyusing“File”then“SaveWorkspaceas..”,orhighlightingthevariablesandright-clickingthem.Ifyoucan’tfindyourworkspacewindoworotherwindows(e.g.cu
4、rrentdirectorywindow),gotothecommandwindow,click“View”andcheckthewindowyouwant.FunctionDescriptioncddirectorya=cd('directory.name')Makedirectorythecurrentdirectory.Itresultsinastringvariablea.deletefilenameDeletethefilefilenamedirdirectorydirListthefilesindirectory.Listthe
5、filesinthecurrentdirectory.pwda=pwdShowcurrentdirectory.Currentdirectoryisstoredina.DirectoryManagementCurrentdirectoryistheoneMatlablooksinfirsttogetfiles.>>cdDisplaysthecurrentdirectory.C:MATLAB6p5work>>cd..Gouponelevel.>>pwdShowcurrentdirectoryans=C:MATLAB6p5>>cdworkG
6、obackdowntothesubdirectory.>>pwdans=C:MATLAB6p5work>>dirDisplayallfilesincurrentdirectory.GenData.mWindTable.mtemp.jpg..Q1.datQ2.dattemp.dat>>dir*.datDisplayfileswith.datextension.Q1.datQ2.dattemp.dat>>dirQ*.datDisplay.datfilesstartingwithQ.Q1.datQ2.datShowcurrentdirector
7、yandfilesinthedirectory.CurrentDirectoryWindowAnotherwayofchangingdirectoriesistousethemenubar.>>pathMATLABPATHC:MATLAB6p5toolboxmatlabgeneralC:MATLAB6p5toolboxmatlabopsC:MATLAB6p5toolboxmatlablangC:MATLAB6p5toolboxmatlabelmatetc…SearchPathPathisalistofdirec
8、toriesinwhichMatlablooksforM-filesanddata.Thecurrentdirectoryisinit,plusalotofdire
此文档下载收益归作者所有