How to realize the variable number of input parameters
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Chao Zhang
el 6 de Jul. de 2021
Respondida: Yongjian Feng
el 6 de Jul. de 2021
we usually introduce two endpoints (x1,y1) and (x2,y2) for a line
N = 50;
prompt = transpose({'X1:', 'Y1:', 'X2:', 'Y2:'});
title_text = 'Input X and Y';
point = inputdlg(prompt, title_text,[1,length(title_text) + N]);
However, if there are variable number of lines, which means we need to input variable number of endpoints
For example, num_line (i.e. number of line) = n (n=1,2,3,4...), so we need to input 2*n endpoints for 'n' lines
Is there have any method to do it?
Thanks for your help!
0 comentarios
Respuesta aceptada
Yongjian Feng
el 6 de Jul. de 2021
How about input two arrays of coordinates? x=[1,2,3,4], y=[5,6,7,8] for example? Your function takes input of two arrays. It doesn't matter how long the arrays are.
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Special Characters en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!