The input character is not valid in MATLAB statements or expressions

4 visualizzazioni (ultimi 30 giorni)
The following code was running. But from today I found this error.
clear all;
close all;
clc
sample_dna2 = fastaread('MT450872_covid.fasta');
sample_dna2 = struct2cell(sample_dna2);
sample_dna2 = cell2mat(sample_dna2(2));
seq2 = sample_dna2(1:29782);
[x2] = dna_binary_double(seq2);
DNAWALK2 = cumsum(x2);
dwtmode('per');
[C,S] = wavedec(x2,8,'coif4');
A5 = appcoef(C,S,'coif4',8);
The total error message is showing as-
Error: File: appcoef.m Line: 1 Column: 4
The input character is not valid in MATLAB statements or expressions.
Error in DNAWALK (line 12)
A5 = appcoef(C,S,'coif4',8);
Please help.
  3 Commenti
SUBHAJIT KAR
SUBHAJIT KAR il 4 Giu 2020
Here is the output of the command -'which appcoef -all':
C:\Program Files\MATLAB\R2016a\toolbox\wavelet\wavelet\appcoef.m
SUBHAJIT KAR
SUBHAJIT KAR il 4 Giu 2020
Any recomendation to solve the problem? I think the inbuilt function is not working.

Accedi per commentare.

Risposta accettata

Steven Lord
Steven Lord il 4 Giu 2020
Have you opened the appcoef function in the Editor previously, even accidentally? If so, open it in the Editor again and see if you'd accidentally typed something in line 1 column 4 of the file when you had it open previously. Don't make any other changes to it, and if you do need to eliminate the extra character save the file and close its tab in the Editor as soon as possible.

Più risposte (1)

Jay Delfin
Jay Delfin il 14 Giu 2021
??? Error: File: Untitled9.m Line: 1 Column: 11
The input character is not valid in MATLAB statements or expressions. how to fix this
M = input(’Matrix size:’);
A = zeros(M);
A(1,1:M-1) = 1;
A(1:M-1,M) = 2;
A(M,2:M) = 3;
A(2:M,1) = 4;
figure, imagesc(A), axis equal off
  4 Commenti
Steven Lord
Steven Lord il 22 Nov 2022
I'm guessing the character before the 0.44 on that first line is not a hyphen (-) but is instead a dash, inserted by Microsoft Word or Microsoft Outlook. Compare the line copied from your post (the first line below) and a copy of that line where I selected the dash and pressed the hyphen key on my keyboard (the second line below.) The second of those commands should run and the first should error.
p = [0.8 0.44 0.36 0.02];
p = [0.8 -0.44 0.36 0.02];
Les Beckham
Les Beckham il 22 Nov 2022
And, as in @Steven Lord's answer from 14 Jun 2021, the single quote characters in the xlabel and ylabel command lines are also not normal single quote characters.
double('‘T...n’')
ans = 1×7
8216 84 46 46 46 110 8217
double('''')
ans = 39

Accedi per commentare.

Categorie

Scopri di più su Entering Commands in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by