フィルターのクリア

Error Using fprintf Invalid file identifier. Use fopen to generate a valid file identifier.

1 回表示 (過去 30 日間)
Hello,
I have this script.
I = (kron(ev1_of_alice,(ev1_of_bob+ev2_of_bob)))+kron(ev2_of_alice,(ev1_of_bob-ev2_of_bob));
if ~isnan(I)
fprintf("I = "+ I + "\n");
if abs(I)>2
fprintf("Violated Bell Inequality");
end
else
fprintf("Not enough data to determine S\n")
end
And when I run the script I have this error:
Error Using fprintf Invalid file identifier. Use fopen to generate a valid file identifier.
But I dont understand anything I is not a file I am trying to write a value not a file. How can I solve it?

採用された回答

the cyclist
the cyclist 2020 年 6 月 21 日
Is this good enough?
I = rand(2);
if ~isnan(I)
I
if abs(I)>2
fprintf("Violated Bell Inequality");
end
else
fprintf("Not enough data to determine S\n")
end

その他の回答 (1 件)

madhan ravi
madhan ravi 2020 年 6 月 21 日
"I = "+ I + "\n" % without fprintf(...)
  3 件のコメント
madhan ravi
madhan ravi 2020 年 6 月 21 日
I figured it out, was waiting for his response.
Gözde Üstün
Gözde Üstün 2020 年 6 月 25 日
Thank you very much. Yeah I was the numeric array

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

カテゴリ

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

タグ

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by