Beantwortet
I'm trying to display pascals triangle but the higher numbers are messing up the formatting, any solutions?
You can specify some field widths in your fprintf calls. rows = 15; PT = zeros(rows); for c = 1:rows PT(c,1) = 1; f...

mehr als 3 Jahre vor | 1

Beantwortet
Vectorize output of for loop, but using specific vector values
k=1.38E-23; E0= 2.72361635536024e-21 M=3; myVector = zeros(M+1,1); T = [100,300,1000,3000]; for ii = 1:numel(T) ...

mehr als 3 Jahre vor | 0

| akzeptiert

Beantwortet
comparision of data with logic given as input
Assuming T1, ..., T10 are scalars, T = [T1 T2 T3 T4 T5 T6 T7 T8 T9 T10]; [~,idx] = max(T); I = zeros(size(T)); I(idx) = ...

mehr als 3 Jahre vor | 0

| akzeptiert

Beantwortet
How to label the x axis in matlab for boxplot ?
xticklabels({'january','feb','mar'})

mehr als 3 Jahre vor | 0

| akzeptiert

Beantwortet
combine cell data into column
M = vertcat(C{:}); where C is your cell array; M will be your big column vector.

mehr als 3 Jahre vor | 0

| akzeptiert

Beantwortet
Changing numeric matrix name with the loaded file
[fn,pn] = uigetfile('*.mat','Select .mat File'); if isequal(fn,0) return % user closed dialog without selecting a file ...

mehr als 3 Jahre vor | 0

Beantwortet
plot a graph from user input
Change this: plot(u,t) to this: plot(t,u)

mehr als 3 Jahre vor | 0

Beantwortet
ASCII/HAMMING DECODER
It's been awhile since I studied error-correcting codes, but I believe that with this generator matrix: G = [1 0 0 0 1 1 0; ...

mehr als 3 Jahre vor | 0

| akzeptiert

Beantwortet
How to plot histogram using given data ?
% Value first Second third M = [ ... 10 0.67 0.66 0.70; ... 20 0.38 0.37 0.42; ... 30 0.26 0.25 0...

mehr als 3 Jahre vor | 0

| akzeptiert

Beantwortet
How to change a range of numbers in a matrix to a random number of a matrix?
G = reshape(1:125,[25,5]) x = setdiff(0:24, 2:25) idx = G >= 2 & G <= 25; G(idx) = x(randi(numel(x),[nnz(idx),1]))

mehr als 3 Jahre vor | 0

| akzeptiert

Beantwortet
Parsing this line 'Step Information: Rload=100 R1=1 (Run: 2/18)'
Here's one way: % Example line to parse line = 'Step Information: Rload=100 R1=1 (Run: 2/18)'; % Parse the line using rege...

mehr als 3 Jahre vor | 0

Beantwortet
Appdesigner get Index and String from DropDownMenu
If you need the index and the string, then the way you're doing it is good. If you just need the string, you should do away wit...

mehr als 3 Jahre vor | 0

Beantwortet
How to plot a trajectory with varying colour?
"I'm trying to assign an independent variable to a data point in 2D through colour." You can choose any colour(s) you like. Ex...

mehr als 3 Jahre vor | 0

| akzeptiert

Beantwortet
Develop a reordering matrix based on stored vectors
order_old = [1 2 3 4 5 6]; order_new = [4 5 1 2 3 6]; Output = order_old.' == order_new

mehr als 3 Jahre vor | 0

| akzeptiert

Beantwortet
Retrieve App Designer textarea content along with the newline characters
The multi-line text is stored as a cell array of character vectors in the textarea's Value, so to present it with newlines, you ...

mehr als 3 Jahre vor | 1

| akzeptiert

Beantwortet
Extracting Corresponding values from an array
Example usage, function defined below. matrix = [1 2; 3 4; 5 6; 1 8] get_2nd_column_val(matrix,3) get_2nd_column_val(matrix,1...

mehr als 3 Jahre vor | 0

| akzeptiert

Beantwortet
Create function to convert data type as table: 2 errors
One problem appears to be that the function expects a table but you're giving it a categorical array. I can't say for sure becau...

mehr als 3 Jahre vor | 1

| akzeptiert

Beantwortet
How to iterate through the struct char to label a new struct correctly?
for x = 1 : length(theFiles) baseFileName = theFiles(x).name; %e.g. for x =1 , baseFileName = 'sample_1.mat' [~,fn,~] ...

mehr als 3 Jahre vor | 0

Beantwortet
Polyfit function is returning a partial line of best fit
Rather than calling plot with the fitobject returned from fit, you can use coeffvalues to get the coefficients of the fitobject ...

mehr als 3 Jahre vor | 1

Beantwortet
ASCII TO HAMMING CODE 7.4
I would check that you're putting the elements of encodedMsg in the right order here: encodedMsgStr = num2str(encodedMsg(:).');...

mehr als 3 Jahre vor | 0

| akzeptiert

Beantwortet
How do I create a loop to give me cut-off value
cutoff = 1500; vals = [200,450,950,1000,1200,1450,1550,1600,1650]; for ii = 1:numel(vals) if vals(ii) >= cutoff ...

mehr als 3 Jahre vor | 1

| akzeptiert

Beantwortet
made up function not running in matlab, error: unrecognized function or variable. How can I get this fixed?
Looks like the first three lines: image1 = imread('ex.tif'); [avg_profile, radius] = radialProfile(image1, 12); plot(radius, ...

mehr als 3 Jahre vor | 0

| akzeptiert

Beantwortet
how extract table RowNames based on table elements
% a table as you describe t = table([1;NaN;3;4;NaN],'RowNames',{'A';'B';'C';'D';'E'}) % extract RowNames of the NaN rows nan_...

mehr als 3 Jahre vor | 0

| akzeptiert

Beantwortet
How to extract column index based on value in another column?
% first I create a table of random data n_rows = 15; data = zeros(n_rows,4); for ii = 1:n_rows data(ii,:) = randperm(4);...

mehr als 3 Jahre vor | 0

Beantwortet
How to assign 0 or 1 randomly to the coordinates?
val = randi([0 1], size(X)) ;

mehr als 3 Jahre vor | 0

Beantwortet
Load multiple files on MATLAB
n_files = 10; VACF_all = zeros(n_files,100); % Pre-allocate a matrix to store all the VACF results. ...

mehr als 3 Jahre vor | 0

| akzeptiert

Beantwortet
Not able to combine data in cells of different sizes
Here's one way. The idea is to use NaNs to fill out the matrix you build. n_files = 30; n_c = 0; c = NaN(n_c, n_files); fo...

mehr als 3 Jahre vor | 1

| akzeptiert

Beantwortet
Looping through sets of names for a match and selecting variable with this name
You're comparing a numeric index (xx), which is between 1 and length(accvectors_name), with a length-3 character vector (ID). In...

mehr als 3 Jahre vor | 1

| akzeptiert

Beantwortet
How to eliminate a number of rows at certain points of a large data set?
If rawdata is your matrix: % number of rows in your matrix: N_rows = size(rawdata,1); % construct a logical vector of 500 t...

mehr als 3 Jahre vor | 1

| akzeptiert

Beantwortet
How can I plot contour lines on the generated map?
In your code, you make the map then create a new figure for each contour. Those new figures aren't going to have the map; the ma...

mehr als 3 Jahre vor | 0

| akzeptiert

Mehr laden