Getting an error For colon operator with char operands, first and last operands must be char.

10 ビュー (過去 30 日間)
Joshua Meyer
Joshua Meyer 2021 年 11 月 16 日
編集済み: Stephen23 2021 年 11 月 17 日
Im getting an error called "Error using : For colon operator with char operands, first and last operands must be char." I have the code that im trying to use for reference. I asked my professor about it and he doesnt have a solution for me and suggested me to talk to someone that might here.
  3 件のコメント
Stephen23
Stephen23 2021 年 11 月 16 日
The error message is easy to reproduce:
1:'a':100
Error using :
For colon operator with char operands, first and last operands must be char.
But because you do not explain anything about your code, we have no idea what you are trying to achieve or why.
Joshua Meyer
Joshua Meyer 2021 年 11 月 17 日
編集済み: Joshua Meyer 2021 年 11 月 17 日
clear
clc
k=.0004
Re=2.*10.^6
F=@(f) -.86*ln((k./3.7)+(2.51./Re.*sqrt(f)))-sqrt(1/f)
j=('Input number of crossings =')
for i=1:j
f=input('the approxmate f where F is zero =')
fzero(F,f)
end
This is the code i have that results in the error

サインインしてコメントする。

回答 (1 件)

Stephen23
Stephen23 2021 年 11 月 17 日
This line
j=('Input number of crossings =')
should be
j = input('number of crossings =')
  3 件のコメント
Joshua Meyer
Joshua Meyer 2021 年 11 月 17 日
OHHHHH i feel so dumb. thanks for the help. stupid simple mistakes changes everything
Stephen23
Stephen23 2021 年 11 月 17 日
編集済み: Stephen23 2021 年 11 月 17 日
@Joshua Meyer: sometimes a second pair of eyes is handy :) Please remember to accept my answer!

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeProgramming についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by