現在この質問をフォロー中です
- フォローしているコンテンツ フィードに更新が表示されます。
- コミュニケーション基本設定に応じて電子メールを受け取ることができます。
エラーが発生しました
ページに変更が加えられたため、アクションを完了できません。ページを再度読み込み、更新された状態を確認してください。
古いコメントを表示
does anyone know how can a variable parameter convert to string? for example in under case, i parameter, (that, is a variable parameter) needs to be a variable string:
for i=1:10
lable=['input'''' i ''' ];
[r,'''i''']=xlsread(lable);
end
that i want to read input1 , input2,....,input10 and put them respectively r1,r2,..,r10
採用された回答
Walter Roberson
2011 年 9 月 3 日
10 件のコメント
mohammad
2011 年 9 月 3 日
thanks let me check now
mohammad
2011 年 9 月 3 日
i studied sprintf and eval, sorry i am beginner in Matlab, why matlab errores for :sprintf('A%d', i)=sprintf('xlsread(lableinput%d)', i)
this is for
A1=(input1.xls)
A2=(input2.xls)
.
.
.
.
.
Walter Roberson
2011 年 9 月 3 日
Don't Do That!
basename = 'labelinput';
for i = 1:10
A{i} = xlsread(sprintf('%s%d.xls', basename, i));
end
Then use A{1} instead of A1, A{2} instead of A2, and so on.
What you are trying to do in making A1, A2, and so on, almost always runs in to problems.
mohammad
2011 年 9 月 3 日
so nice, perfect
now i need in every loop it shows : fprintf(' finished checking of input' 'i')
for example after A1=input1.xls shows:finished checking of input1
and after A2=input2.xls shows:finished checking of input2
but i dont know how putting variable (i), in fprintf
mohammad
2011 年 9 月 3 日
i mean this:
for i = 1:10
A{i} = xlsread(sprintf('%s%d.xls', basename, i));
fprintf(' finished checking of input' 'i')
end
mohammad
2011 年 9 月 3 日
and you are right Walter i dont need trying to make A1, A2
Walter Roberson
2011 年 9 月 3 日
fprintf('finished checking of input %d\n', i);
mohammad
2011 年 9 月 3 日
so thanks Walter
you really give a lot helps
for last question:
how can put variable in this speech:
NET.addAssembly('System.Speech');
speaker = System.Speech.Synthesis.SpeechSynthesizer();
speaker.Rate = 1;
speaker.Volume = 100;
speaker.Speak(['finished checking input'''i'''']);
Walter Roberson
2011 年 9 月 3 日
speaker.Speak(sprintf('finished checking input %d', i));
mohammad
2011 年 9 月 3 日
great, perfect!
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で String Parsing についてさらに検索
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
- América Latina (Español)
- Canada (English)
- United States (English)
ヨーロッパ
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
