Professional Documents
Culture Documents
2023A CVLD251 C3 Parcial
2023A CVLD251 C3 Parcial
CVLD251:
PROGRAMACIÓN
CAPÍTULO 3:
PROGRAMACIÓN BÁSICA EN MATLAB
2
CLASE 6
3
3.1 Entrada y salida de archivos
Leer archivos:
[NUM,TXT,RAW]=xlsread(FILE)
- lee de la primera hoja de un archivo de excel.
- Devuelve en NUM los datos numéricos, en TXT los datos tipo texto, y datos no
procesados en RAW.
[NUM,TXT,RAW]=xlsread(FILE,SHEET,RANGE)
- Lee de un archive FILE, de una hoja SHEET, y dentroo del rango RANGE
4
https://www.mathworks.com/products/matlab/programming-with-matlab.html
3.1 Entrada y salida de archivos
Leer archivos:
M = csvread('FILENAME',R,C)
- Lee desde la fila R y la columna C
- Empieza desde cero
M = csvread('FILENAME',R,C,RNG)
- Lee desde el rango RNG: RNG = [R1 C1 R2 C2]
- (R1,C1) esquina superior izquierrda
- (R2,C2) esquina inferior derecho
5
https://www.mathworks.com/products/matlab/programming-with-matlab.html
3.1 Entrada y salida de archivos
Ejemplo:
datos.xlsx
6
https://www.mathworks.com/products/matlab/programming-with-matlab.html
3.1 Entrada y salida de archivos
Escribir archivos:
xlswrite(FILE,ARRAY)
- Escribe un arreglo ARRAY a la primera hoja del archive FILLE
- Empieza en A1
xlswrite(FILE,ARRAY,SHEET)
- Escribe un arreglo array, en el archive file, en la hoja SHEET.
7
https://www.mathworks.com/products/matlab/programming-with-matlab.html
3.1 Entrada y salida de archivos
8
https://www.mathworks.com/products/matlab/programming-with-matlab.html
3.1 Entrada y salida de archivos
9
https://www.mathworks.com/products/matlab/programming-with-matlab.html
3.2 Algebra y asignación de variables
Operaciones básicas
OPERACIÓN SIMBOLO
suma +
resta -
Multiplicación *
división /
potencia +
>> a = 7
>> b = 9
>> a*b/(a^5)
ans =
0.0037
>>
10
https://www.mathworks.com/products/matlab/programming-with-matlab.html
3.2 Algebra y asignación de variables
https://www.universoformulas.com/fisica/cinematica/movimiento-parabolico/ 11
CLASE 7
12
3.3 Estructuras de control
Descripción: MATLAB
13
https://www.mathworks.com/products/matlab/programming-with-matlab.html
3.4 Creación de scripts
Descripción: MATLAB
14
https://www.mathworks.com/products/matlab/programming-with-matlab.html