I'm getting a new line (without adding \n) and an indented line when using the function input() (MATLAB Online)
7 次查看(过去 30 天)
显示 更早的评论
Hello,
I have been trying to read the input from the user using the input function as shown below.
function open_webpage
url = input("Enter the url: ", "s");
while isempty(url)
fprintf("You didn't enter any url. Please try again.\n")
url = input("Enter the url: ", "s");
end
end
The function works fine so far. However, when I run it, I keep getting a new line when prompted to enter the URL as shown below. Also, I don't understand why is the text indented.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1565469/image.png)
I even checked the documentation and it seems I did everything correctly. Am I missing something?
3 个评论
Dyuman Joshi
2024-2-12
@Israe, did you contact Technical support?
What did they say? Is the issue resolved?
采纳的回答
prabhat kumar sharma
2024-1-17
Hi Israe,
I also reproduced this issue at my end and I found that there is an extra new line printed without using '\n' in matlab online while this behaviour is not in seen in matlab desktop app.
I'll recommend you to report this bug to Mathworks technical support.
1 个评论
Taine
2024-7-16
I have this problem on the new desktop app, just to let anyone interested here know.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Environment and Settings 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!