How to write a program to generate a data file containing the names and corresponding telephone numbers of the costumers?
Mostrar comentarios más antiguos
how to write the basic program to generate the data file containing names and telephone number and what is the procedure to enter names in the program.
Respuestas (1)
John BG
el 30 de En. de 2016
just recommended to another MATLAB CENTRAL user to try the class TABLE. The starter example from MATLAB help:
LastName = {'Smith';'Johnson';'Williams';'Jones';'Brown'};
Age = [38;43;38;40;49];
Height = [71;69;64;67;64];
Weight = [176;163;131;133;119];
BloodPressure = [124 93; 109 77; 125 83; 117 75; 122 80];
T = table(Age,Height,Weight,BloodPressure,'RowNames',LastName)
modify the above example accordingly to build your telephone directory.
Save your telephone directory to a .mat file with
save('phonedir_filename.mat','T')
And bring it back to workspace in new MATLAB session with
load phonedir_filename.mat
You can also have MATLAB writing and reading from a directory stored in a support Excel file with xlsread and xlswrite
John
2 comentarios
aditya goyal
el 1 de Feb. de 2016
Editada: aditya goyal
el 1 de Feb. de 2016
John BG
el 9 de Feb. de 2016
Aditya, the code works, It's the standard example from MATLAB help. MATLAB 2015. What Matlab version are you using. There are earlier versions of Matlab that do not have the class table implemented, the command table() is not recognized.
table class was introduced in R2013b, if you upgrade the command table will work. Alternatively, you can build your own structure, a table is just a specific type of structure.
Categorías
Más información sobre Spreadsheets en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!